diepm / vim-rest-console

A REST console for Vim.
658 stars 54 forks source link

Serialized JSON in GET request #33

Closed chaucerbao closed 8 years ago

chaucerbao commented 8 years ago

StrongLoop LoopBack REST APIs can use serialized JSON objects in their query string.

/api/example?filter={"where":{"id":1234}}

Brackets in cURL are for globbing, so a solution is to include the -g option to disable globbing.

Is there (or can we have) an option to append arguments to the cURL command, either globally or as-needed?

Other solutions are welcome as well.

diepm commented 8 years ago

Do { and } must present or can they be url-encoded? For example, if I have this request block,

http://example.net
GET /api/example
filter={
  "where": { "id": 1234 }
}

VRC generates this GET request

GET /api/example?filter=%7B%20%20%22where%22%3A%20%7B%20%22id%22%3A%201234%20%7D%7D

Does it work in your scenario?

chaucerbao commented 8 years ago

This works!

For some reason, I thought that syntax was for submitting data in the request body rather than the query string.

diepm commented 8 years ago

Great! To include the request body for GET request, we need to explicitly enable the option vrc_allow_get_request_body.