Upload a text file on hipchat room using Curl

384 views Asked by At

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
1

There are 1 answers

2
AdityaReddy On

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