If you start a hipchat account today, you are put on v2 by default. All the 
v1 documents are also  marked deprecated.

So, I made an attempt to support v1 and v2 
here: 
https://github.com/mikemilano/ansible-modules-extras/blob/devel/notification/hipchat.py

I added a new module parameter: version which can be set to 1 or 2.

It's close, but I still get 400 bad request when I'm using it for v2. I 
upgraded my hipchat account so I no longer have access to a v1 account to 
make sure version 1 still wroks.



Here are the API differences from what I can tell:

   - The API base is: https://api.hipchat.com/v2
   - The endpoint for a notification went 
   from https://api.hipchat.com/v1/rooms/message to room/RoomName/notification
   - Since room is in the request path now, it is no longer a valid 
   parameter
   - Issuing this as a GET request is no longer an option. POST only
   - "room_id" is no longer a parameter
   - "from" is no longer a parameter
   - "format" is no longer a parameter (not to be confused with 
   "message_format", which still is valid

V1 API: https://www.hipchat.com/docs/api/method/rooms/message
V2 API: https://www.hipchat.com/docs/apiv2/method/send_room_notification

I am pretty sure my forked version is close to working, but it may be my 
lack of experience with the plugin system... specifically how exactly 
AnsibleModule() impacts the plugin and how to use the fetch_url() method 
properly. i.e. I'm not sure what the impact of passing the AnsibleModule is 
into fetch_url() yet and it may be this that is the problem since I'm 
pretty sure I've got all the v2 parameters setting correctly before it 
sends the request.









On Saturday, May 31, 2014 9:26:23 AM UTC-7, Michael DeHaan wrote:
>
> No one does, because it's written for the v1 API yet.
>
>
>
>
> On Wed, May 28, 2014 at 9:52 AM, Lars Sommer <[email protected] 
> <javascript:>> wrote:
>
>> I will work on it more today but you could receive a 401 if you were 
>> using a notification API token that is assigned to a particular room and 
>> you were trying to use it to authenticate anywhere else that was a valid 
>> URL. My main concern was how the URL string got assembled by the module 
>> parameters.
>> I was more interested in whether anyone actually had any experience 
>> *using* the module with the v2 API of hipchat. 
>>
>>
>>
>>
>> On Tue, May 27, 2014 at 9:25 PM, James Cammarata <[email protected] 
>> <javascript:>> wrote:
>>
>>> According to this: https://www.hipchat.com/docs/api, the v2 API is 
>>> still in beta, so there should not be any issues with the module as it 
>>> stands. A 401 indicates an authorization issue, not a target URL problem, 
>>> so I would double check your API token and username.
>>>
>>>
>>> On Tue, May 27, 2014 at 3:55 PM, Lars Sommer <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> http://docs.ansible.com/hipchat_module.html
>>>> https://www.hipchat.com/docs/apiv2/method/send_room_notification
>>>>
>>>> Difference in expected URL:
>>>> https://api.hipchat.com/v1/rooms/message
>>>> vs
>>>> https://api.hipchat.com/v2/room/{id_or_name}/notification
>>>>
>>>> I was receiving a 401 until I started messing with the api parameter 
>>>> and couldn't find a combination that wouldn't give a 404 and I believe 
>>>> that's due to the fact that the hipchat module is passing in the message 
>>>> in 
>>>> the wrong spot. 
>>>>
>>>> Can anyone verify?
>>>>
>>>> My intended usage is to use a hipchat notification API token passed in 
>>>> to notify of play completion.
>>>>  
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Ansible Project" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected] <javascript:>.
>>>>
>>>> To post to this group, send email to [email protected] 
>>>> <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/ansible-project/8584482c-9228-4f14-9d5c-d737478c4a6b%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/8584482c-9228-4f14-9d5c-d737478c4a6b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Ansible Project" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/ansible-project/1O71MoYaqGw/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected] <javascript:>.
>>>
>>> To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/CAMFyvFjaTgyrCW%3D_fEatHKO8525oCnSyNTqn3QpuPfjnGSkYHA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/CAMFyvFjaTgyrCW%3D_fEatHKO8525oCnSyNTqn3QpuPfjnGSkYHA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> -Lars
>> about.me/jsommer
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAKacZUVDvYtsSFEwc8COKO4xU%3D%2B_wvWswD7KYaD-MmAVm-ohXA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/CAKacZUVDvYtsSFEwc8COKO4xU%3D%2B_wvWswD7KYaD-MmAVm-ohXA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/24bd24d7-84e7-4ffa-a0c8-02dcf4ea6e01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to