cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

PUT values to a Thing Property by POSTMAN Collection Run

SOLVED
dsgnrClarK
Moonstone

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.

raw.png
single cr.png
As I tried to use the Collection Run to PUT a series of values. I got 403 error.
form-data.png

cr 403 error.png


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.

cr 400 error.png

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: PUT values to a Thing Property by POSTMAN Collection Run

I checked the subsystem configuration, same as yours.

subsystem configuration.png

 

Nevertheless,  after accidentally system reboot. POSTMAN Collection Run works out flawlessly.

@tsaifee-2 Thank you very much for helping, really appreciate it.

View solution in original post

12 REPLIES 12

Re: PUT values to a Thing Property by POSTMAN Collection Run

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:

 

Re: PUT values to a Thing Property by POSTMAN Collection Run

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.

Re: PUT values to a Thing Property by POSTMAN Collection Run

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.

Re: PUT values to a Thing Property by POSTMAN Collection Run

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).

different DATA with Iterations.png

 

Iteration 1, Iteration 2, Iteration 3... and so on. Like the picture below:

cr 403 error.png

Tags (1)

Re: PUT values to a Thing Property by POSTMAN Collection Run

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?

Re: PUT values to a Thing Property by POSTMAN Collection Run

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.

cr 403 error.png

cr 400 error.png

 

Is anything there for further information?

 

My Thingworx runs on 8.4.3-b2219.

 

Thanks a lot.

Re: PUT values to a Thing Property by POSTMAN Collection Run

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.

Re: PUT values to a Thing Property by POSTMAN Collection Run

Is this the right place to look up?

twx, monitoring, logs.png

 

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

 

Re: PUT values to a Thing Property by POSTMAN Collection Run

For your request, please try setting Body = Raw
{"mailbox":"{{mailbox}}"}

 

Please see my screenshot below.

 

CollRun3.PNG

Re: PUT values to a Thing Property by POSTMAN Collection Run

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.

 

 

Re: PUT values to a Thing Property by POSTMAN Collection Run

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?

Re: PUT values to a Thing Property by POSTMAN Collection Run

I checked the subsystem configuration, same as yours.

subsystem configuration.png

 

Nevertheless,  after accidentally system reboot. POSTMAN Collection Run works out flawlessly.

@tsaifee-2 Thank you very much for helping, really appreciate it.

View solution in original post

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.