1

I am using bash script to run the Protractor automation script. I am getting results in the text file. Now I want to upload that file on the hipchat room.

I am able to get the the content of the file but I want to upload actual text file on the hipchat. Please help!

Here is my curl command which displays file content on the hipchat room:

curl  -i -X POST -H 'Content-Type: text/plain'-F "file=@target/screenshots/AutomationReport.txt" https://dev.hipchat.com/v2/room/3157124/notification?auth_token
sigma
  • 29
  • 2
  • 6

1 Answers1

0

Looks like you are using the wrong API to share a file. As per the official docs at HiPCHat the correct way to share a file in a room is

POST /v2/room/{room_id_or_name}/share/file

For Complete usage guide check here Let me know if that works

EDIT1: The auth_token has to be passed as earlier. The request will look something like below

POST /v2/room/3157124/share/file?auth_token

AdityaReddy
  • 3,625
  • 12
  • 25
  • Hi Aditya - I tried : curl -X POST -H 'Content-Type: text/plain' "file=@target/screenshots/AutomationReport.txt" https://dev.hipchat.com/v2/room//share/file But getting following error message: { "error": { "code": 401, "message": "Authenticated requests only. See https://www.hipchat.com/docs/apiv2/auth for more information.", "type": "Unauthorized" } } Can you please let me know how do I need to set up API, Thanks – sigma Dec 20 '16 at 16:28
  • You have to pass the `?auth_token` as you were doing it earlier and also replace the roomID with the one you have in earlier request. I have updated the answer accordingly – AdityaReddy Dec 21 '16 at 03:57