08-01-2023 02:17 PM
Hi to all,
Relatively beginner with the HTTP Client library, I was able successfully to send JSON commands via Labview.
Actually I'm working in order to post via Webex pictures.
In the official Cisco manual, the cURL command it would be as example:
curl --request POST \
--header "Authorization: Bearer ACCESS_TOKEN" \
--form "roomId=Y2lzY2....." \
--form "text=example attached" \
--form "files=@/home/desktop/example.png;type=image/png" \
https://webexapis.com/v1/messages
I am able to create a message, but I have no clue at the end to physically post the file.
Do you have any example to share?
I tried with the VI in picture, but answers are:
HTTP/1.1 400 Bad Request
Date: Tue, 01 Aug 2023 19:13:50 GMT
Content-Type: application/json
Connection: close
via: 1.1 linkerd, 1.1 linkerd
trackingid: ROUTER_xxxxx
server: Redacted
x-content-type-options: nosniff
x-content-type-options: nosniff
vary: accept-encoding
strict-transport-security: max-age=63072000; includeSubDomains; preload
{"message":"The request could not be understood by the server due to malformed syntax.","errors":[{"description":"The request could not be understood by the server due to malformed syntax."}],"trackingId":"ROUTER_xxxxx"}
Thanks so much.
Solved! Go to Solution.
08-01-2023 03:06 PM
A couple things that look off in your screenshot:
Note: In this example I used the name + value + filename to indicate a server side file but in your example you can use name + file + filename. See the POSTMultipart VI docs about postdata cluster configuration.
Example output from the third party httpbin tool showing the two form fields and the file were identified as well as the Authorization header:
08-01-2023 03:15 PM
Hi,
I just created a work-around using the cmd terminal, and it's working.
Thanks for the reply.
I will try your suggestion later, to see if I can follow your instructions.
08-01-2023 04:22 PM
Thanks so much for the support!
I was able to send correctly the file.