RobotStudio event

POST to array of pos via WebServices

Options
Hello, I have been trying to update the values held in a RAPID array of type "pos" via POST request but so far I am not having any luck. I am able to do a GET on the array and receive a response but I guess I must not have the correct syntax for POST.

I am trying to post to the following url via Postman:

https://127.0.0.1:666/rw/rapid/symbol/RAPID/T_ROB1/AlignmentCalculator/SheetPointsArray/data

and then in the body I have for my KEY "value" and for the VALUE "[[20,20,0],[100,20,0],[100,100,0],[20,100,0]]"

but I get back HTTP response 415 Unsupported Media Type and retcode 
-1073414146

If anyone could please point me to where I'm going wrong I would be grateful!
Tagged:

Best Answer

Answers

  • MikeTT
    MikeTT
    edited November 2020
    Options
    Hi Nils,

    Thanks for the response. You were right my content type was set to "application/x-www-form-urlencoded" and I think I needed to set it to "application/x-www-form-urlencoded;v=2.0", I also noticed that I was sending my value as form data rather than x-www-form-urlencoded. So I am no longer getting a 415 response.

    Unfortunately I am now getting 400 Bad Request and a different ret code. Here is the lookup response:

    <span class="name">SYS_CTRL_E_RAPID_SEMANTIC_ERROR</span>
    <span class="code">-1073442802</span>
    <span class="severity">Error</span>
    <span class="description">Operation not allowed due to semantic error(s).</span>

    Any ideas what the semantic error could be here?

    Edit: It seems to be due to the fact that my array size in RAPID was set to 64 but I was only posting 4 points, when I reduced the array size to 4 the request worked fine, so I guess if I want to keep the max size as 64 I will need to pad out my post value with empty points. 

    Thanks for the help, you can close the thread if you like.