Within HipChat one can use "/code" to display code within the HipChat client. Is it possible to do this via the API? In my Python code, I wrapped my text around "<code>my super duper code</code>" but it doesn't display it like what one would see if I use the keyboard shortcut.
Yes, this is possible through the send_message API. Here's an example:
curl -d '{"message":"/code your code goes here"}' -H 'Content-Type: application/json' https://api.hipchat.com/v2/room/<room_id_or_name>/message\?auth_token\=yourpersonaltokengoeshere
I'm using Python and I tried that as well but it didn't parse "/code" correctly.
hipchat_logger.log(20, "/code Hi I should be in a codeblock")
Output:
/code Hi I should be in a codeblock
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you sure you're using the send_message API and not the send_notification API?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looking at the API, it looks like the author is using the "notification" endpoint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What library are you using? If possible, I'd avoid using a library and make the REST calls yourself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.