Methods POST, PUT and PATCH should have body data, and files should be accepted with content-type multipart/form-data
All methods return the same, defined in the data
parameter. The data
value must be a valid JSON.
If your data has simple characters [a-zA-Z0-9_-]
appending the JSON to the URL should be enough
/query-json?data={"name":"RequestBoomerang","success":true}
With special characters, the data must be encoded. Javascript example:
fetch('/query-json?data='+ encodeURIComponent(JSON.stringify({name: 'RequestBoomerang🪃', pt: '✔ Já posso testar com dados reais!'})))
All request methods return the same data
response, and an additional __
key is added to the response with some information.
GET/DELETE
fetch('/query-json?data={"hello":"API"}')
{
"hello": "API",
"__": {
"method": "GET", // or DELETE
"query": {
"data": "{\"hello\":\"API\"}"
},
"body": null,
"files": null
}
}
POST/PUT/PATCH
fetch('/query-json?data={"hello":"API"}', {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({id: 42})
})
{
"hello": "API",
"__": {
"method": "POST", // or PUT/PATCH
"query": {
"data": "{\"hello\":\"API\"}"
},
"body": { id: "42" },
"files": null
}
}
The API always returns an object, if the data is an array it will be in the data key
fetch('/query-json?data=[true,1,"RequestBoomerang"]')
{
"data": [true, 1, "RequestBoomerang"],
"__": {
"method": "GET",
"query": {
"data": "[true,1,\"RequestBoomerang\"]"
},
"body": null,
"files": null
}
}
See the return option to return only the array
Additional options can be added to the URL
status
All requests return 200 OK
, this option can change that.
/query-json?status=201&data={"name":"RequestBoomerang"}
will have 201 Created
. HTTP response status codes are available from 200 to 511
return
Can change the return value to an array or object, the __
information key will not be present.
/query-json?status=201&return=data&data=[true,1,"RequestBoomerang"]
[true,1,"RequestBoomerang"]
/query-json?return=obj&data={"success":true,"obj":{"one":1}}
{"one":1}
shuffle
Shuffles an array.
/query-json?shuffle=arr&data={"success":true,"arr":[true,1,null]}
{
"success": true,
"arr": [1, null, true],
"__": {
"method": "GET",
"query": {
"shuffle": "arr",
"data": "{\"success\":true,\"arr\":[true,1,null]}"
},
"body": null,
"files": null
}
}
sleep
Delay the response between 0.5
/query-json?sleep=-1&data={"success":true}
to 5 seconds
/query-json?sleep=5&data={"success":true}
RequestBoomerang doesn’t save any of your data or files