brutallord
brutallord

Reputation: 871

Is that correct to pass JSON in REST query?

Is that correct to use url like that in REST-service for GET query?

http://localhost/service/catalog/get/{"id":1","allLayers":false}

Thanks a lot.

Upvotes: 0

Views: 56

Answers (3)

Zini
Zini

Reputation: 914

localhost/service/catalog/get/2/false

or

localhost/service/catalog/get/2/0

where 0 will be equivalent to false and 1 to true. But seems to me you need to do something like: localhost/service/catalog/get/2?allLayers=false in this case.

It depends what part of your parameters is in the REST rule. In my examples I showed always the :id in the REST format and in one case I showed allLayers also in the rest rule that your rest service use.

Upvotes: 0

tonga
tonga

Reputation: 11981

For GET request, your URL should look like the following:

http://localhost/service/catalog/get?id=1&allLayers=false

So the data will be in the query string part of the URL.

Upvotes: 1

Eric Stein
Eric Stein

Reputation: 13682

No, that's highly atypical. What are you trying to accomplish? Do you want to be using query parameters instead?

Upvotes: 0

Related Questions