Skip to main content
Jul 4, 2021 3:14 PM UTC
Solved

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
TonyZhangAnswer
Jul 13, 2021 3:21 AM UTC

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.

 

6 replies

Jul 5, 2021 1:27 AM UTC

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?

TjafAuthor
Jul 5, 2021 11:39 AM UTC

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.

 

TonyZhangAnswer
Jul 13, 2021 3:21 AM UTC

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.