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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Array in a JSON input

Tjaf
7-Bedrock

Array in a JSON input

Hello there,

 

I am trying to send a JSON as input parameter of a service that I created, from Postman, but I get the following error message : 

"Unable To Parse JSON Request"
 
Here is the structure of my json : 
{
    "box" : 1531,
    "date" : "2021-07-01 14:19:48",
    "count" : [4,0]
}
 
So I selected the follow inputs for my service :
box -> number
date -> string
count -> ??? (I don't know what I have to put, I tried 2D, infotable, json, but nothing works...The parameter count is an array...)
 
Please could you help me to resolve my issue?
 
Best regards,
 
Thomas
ACCEPTED SOLUTION

Accepted Solutions
TonyZhang
15-Moonstone
(To:Tjaf)

Hi

Looks like you didn't format the body correctly in Postman and you need to change the Input Parameters to json type in ThingWorx service.

 

Tony

View solution in original post

6 REPLIES 6
TonyZhang
15-Moonstone
(To:Tjaf)

Hi, I copy and paste the json into a service's input parameter and it seems working just fine.

How did you send Json from Postman to the input parameter of a ThingWorx service?

Tony
Tjaf
7-Bedrock
(To:TonyZhang)

Hi,

 

Here there is my postman Body : (you will notice that I don't have variable, only parameters)

Tjaf_1-1625484456949.png

Here there is my ThingWorx service :

Tjaf_2-1625484968217.png

By this way it's not working...

 

I tried also to put a json as in input parameter but I don't have the name of the JSON variable (if you look at my postman POST), so I don't know how can I select my input parameter...

 

Thank you for your feedback.

 

TonyZhang
15-Moonstone
(To:Tjaf)

Hi

Looks like you didn't format the body correctly in Postman and you need to change the Input Parameters to json type in ThingWorx service.

 

Tony
Tjaf
7-Bedrock
(To:TonyZhang)

Hello Tony,

 

Sorry for the delay, I didn't get any notification, but everything is working.

 

Thank you!

 

Best regards,

 

Thomas

TonyZhang
15-Moonstone
(To:Tjaf)

Hi @Tjaf,

 

Did my reply answer your question? If so, it would be great if you could designate that reply as the Accepted Solution.

 

If not, please let us know your current status in the Community thread for further support.

 

Thank you,

Tony

Tony
TonyZhang
15-Moonstone
(To:TonyZhang)

Hi @Tjaf,

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards,

Tony

Tony
Announcements


Top Tags