1412
Views
5
Comments
Solved
How to send Array of String in Request Params for REST API
Question

Hi,

My Request Params for REST API are:

{
        "UserId":"assif@lapis.com",
         "countries": [ "3", "54", "203" ],
         "products": ["1","3","7"]
}

While I consume API, the Structure for Request is generated as below:

I provided the Text List While calling the API, but the API request is going as below:

countries: {List: ["1","21","22"]}

What I actually want it to be:

  "countries": [ "3", "54", "203" ]


Thanks,

Assif


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Assif,

I'm a bit lost there. You are talking about the browser, while REST communication is always handled by the server, so unless you're calling from mobile, the browser can't see it. Also, if you are on Mobile, what you're seeing is the communicaton between the Mobile App and the server, not between the server and the REST end-point. Please follow these instrutions to enable logging of the REST traffic and check the log what is actually sent.

2021-04-09 11-42-43
assif_tiger
 
MVP

Kilian Hekhuis wrote:

Hi Assif,

I'm a bit lost there. You are talking about the browser, while REST communication is always handled by the server, so unless you're calling from mobile, the browser can't see it. Also, if you are on Mobile, what you're seeing is the communicaton between the Mobile App and the server, not between the server and the REST end-point. Please follow these instrutions to enable logging of the REST traffic and check the log what is actually sent.

Wooo,

Thanks. It saved lot of my time.

It was showing inCorrect in Browser but Actually it was working fine & going Correct.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Assif,

I just tried, and I can't reproduce your problem. In the Integration Logging, I see this:

{"UserId":"Kilian","countries":["1","2","3"],"products":["A","B","C"]}

Note I created the REST service with the same request JSON as you have above. Where did you see the "List"? In the Integration Logging? Someplace else?

2021-04-09 11-42-43
assif_tiger
 
MVP

Kilian Hekhuis wrote:

Hi Assif,

I just tried, and I can't reproduce your problem. In the Integration Logging, I see this:

{"UserId":"Kilian","countries":["1","2","3"],"products":["A","B","C"]}

Note I created the REST service with the same request JSON as you have above. Where did you see the "List"? In the Integration Logging? Someplace else?

I was inspecting under Network tab in Browser & there I check the request param sent  as:

countries: {List: ["1","21","22"]}


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Assif,

I'm a bit lost there. You are talking about the browser, while REST communication is always handled by the server, so unless you're calling from mobile, the browser can't see it. Also, if you are on Mobile, what you're seeing is the communicaton between the Mobile App and the server, not between the server and the REST end-point. Please follow these instrutions to enable logging of the REST traffic and check the log what is actually sent.

2021-04-09 11-42-43
assif_tiger
 
MVP

Kilian Hekhuis wrote:

Hi Assif,

I'm a bit lost there. You are talking about the browser, while REST communication is always handled by the server, so unless you're calling from mobile, the browser can't see it. Also, if you are on Mobile, what you're seeing is the communicaton between the Mobile App and the server, not between the server and the REST end-point. Please follow these instrutions to enable logging of the REST traffic and check the log what is actually sent.

Wooo,

Thanks. It saved lot of my time.

It was showing inCorrect in Browser but Actually it was working fine & going Correct.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Thanks for the feedback. Happy coding!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.