The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hi,
I'm doing post request from Arduino GSM Shield 2 to Thingworx. Right now i want to remotely create a Thing. I've tried with POSTman, the Request is valid and from Postman I can create Thing. I've posted from shield another request to other page, and i know that shield is configured corectly. But when i do the same request from arduino i get 401 error.
My POST (Works in POSTMAN):
POST /Thingworx/Resources/EntityServices/Services/CreateThing?appKey=xxxx-xxx-xxxx-xxx-xxx&method=post&x-thingworx-session=true&name=NewThing&thingTemplateName=GenericThing HTTP/1.1
Host: pp-xxxxxxxxxxxx.devportal.ptc.io
Connection: close
Accept: application/json
Content-Type: application/json
And Response:
HTTP/1.1 401
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: frame-ancestors 'self'
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Date: Tue, 16 Jul 2019 07:05:21 GMT
Connection: close
Can someone tell me wats wrong?
try it without this part: x-thingworx-session=true
You should not need to have to establish a session.
Also make sure that 'switch' methods is enabled (I'm not sure if you are using Postman in GET mode or POST mode)
OK, right now the POST:
POST /Thingworx/Things/ArduinoSensors/Services/ArduinoService?appKey=xxxxxxx-xxxx-xxxx-xxxx-xxxxx&temp=23.70&humd=55.80 HTTP/1.1
Host: 80
Content-Type: application/json
gives me:
HTTP/1.1 400 Bad Request
Date: Wed, 17 Jul 2019 11:19:47 GMT
Server:
Content-Length: 347
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<p>Additionally, a 400 Bad Request
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
I've tried this in postman, and it works. But when i send it from arduino it gives me this error. Dont know why.
Not too sure what is going on, you could try starting out with a simple GET to see if that works, like Thingworx/Things