PUT values to a Thing Property by POSTMAN Collection Run
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
PUT values to a Thing Property by POSTMAN Collection Run
Hi there,
Follow the PTC University course Fundamentals of IoT Development with Whingworx M7.7 Getting Starged with REST. I created another request in POSTMAN which would PUT single value to the Thinwgorx Thing flawlessly.
As I tried to use the Collection Run to PUT a series of values. I got 403 error.
The only thing I changed is the Request Body, but I see no difference in the log.
Both are {"mailbox": "some-string"}
I tried solution the in REST API test of simple service returns HTTP 403.
go to System / Subsystems / PlatformSubsystem / Configuration. Check "Allow Request Method Switch" and uncheck "Filter Content-Type"
And it lead me to error 400.
Meantime,
Disable Metrics Reporting by deselecting the Metrics Reporting Enabled checkbox
like the Calling service API from Postman - 403 mentioned.
So, how to make POSTMAN Collection Run works with Thingworx flawlessly?
Any response would be appreciated.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Troubleshooting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I checked the subsystem configuration, same as yours.
Nevertheless, after accidentally system reboot. POSTMAN Collection Run works out flawlessly.
@tsaifee-2 Thank you very much for helping, really appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, I tested this with Thingworx v8.4.1 and the Collection Run in Postman (for updating multiple Thing properties) seems to work fine, please see the video below:
- Chapters
- descriptions off, selected
- captions settings, opens captions settings dialog
- captions off, selected
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
This is a modal window. This modal can be closed by pressing the Escape key or activating the close button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, @tsaifee-2
Thank you for reply.
But I'm looking a way to PUT multiple iterations to single Property, rather than PUT single value to multiple Properties.
It's that I got a JSON file generated by https://mockaroo.com which contains an array that has many objects in it.
[
{"mailbox": "some random string 1"},
{"mailbox": "some random string 2"},
...
]
My goal is to PUT those values in the JSON file to Thing Property by Collection Run with given Iterations and Delay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So are you trying to make multiple updates (e.g. 1 per second) to the same property on the same Thing using 1 REST PUT request? And you're trying to do it with one REST body in this format ...
[
{"RPM":5},
{"RPM":6}
]
... meaning: Update RPM to 5 and then update it again to 6?
I personally do not think this is the intention of the PUT request, because it is only intended for a single value to be updated. Here in the help center it says PUT - "Write a value" - in the singular form.
If you need to periodically update the same property on the same Thing then I think you need to call the PUT request multiple times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, I'm trying to make multiple updates to the same Property on the same Thing using REST PUT request.
But instead of single PUT Request, with POSTMAN Collection Runner, PUT request would be sent multiple times depends on Iteration and Delay. Each PUT Request contains different Request Body (DATA).
Iteration 1, Iteration 2, Iteration 3... and so on. Like the picture below:
- Tags:
- postman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hmm that's strange, it seems to work fine on my v8.4.1 system. I sent 1000 data lines using Postman Collection Run with a delay of 200ms and I can see that 954 entries were written. A few duplicate line values were not written because there was no change to the property "mailbox", that's normal behaviour. So it seems to have worked fine for me.
Are there any messages in your log file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @tsaifee-2
Thanks for reply.
As I mentioned in original post.
I encountered 2 error. 403 & 400, which were displayed in Collection Runner window.
Is anything there for further information?
My Thingworx runs on 8.4.3-b2219.
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I was wondering if there are any log messages in your Thingworx log files: Application, Security, Communications etc?
Alternatively please feel free to send me a private message and we can arrange a web session so I can take a look at your system. Maybe we can compare the differences as it is working on my side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is this the right place to look up?
The only Error message is
Forbidden content from {{thingworxServer}}/Thingworx/Things/IoT_SIM_RCVR/Properties/mailbox/: multipart/form-data |
Origin c.t.s.c.ContentTypeFilter
Thread http-nio-8080-exec-7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
For your request, please try setting Body = Raw
{"mailbox":"{{mailbox}}"}
Please see my screenshot below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
After changing the Request Body(Raw) to
{"mailbox":"{{mailbox}}"}
For single PUT request it works fine, where the value of Property\mailbox is changed to {{mailbox}}.
ApplicationLog:
Level: Debug
Content: Executing request [URI: /Thingworx/Things/IoT_SIM_RCVR/Properties/mailbox/]
Origin: c.t.w.BaseService
Nevertheless for Collection Runner, even Request Body changes according to the JSON file with each request.
I still get a 403 errors in POSTMAN,
Error log remains the same
Level: Error
Content:
Forbidden content from {{thingworxServer}}/Thingworx/Things/IoT_SIM_RCVR/Properties/mailbox/: multipart/form-data |
Origin: c.t.s.c.ContentTypeFilter
Thread: http-nio-8080-exec-8
Would it be the ContentTypeFilter issue?
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It's working fine in my system, please see the attached PDF for details of my PlatformSubsystem and also the details of an example request which gets sent by the Collection Runner. Could you please send me a similar full printout of your Collection Runner example request?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I checked the subsystem configuration, same as yours.
Nevertheless, after accidentally system reboot. POSTMAN Collection Run works out flawlessly.
@tsaifee-2 Thank you very much for helping, really appreciate it.
