Parameters
To pass parameters in API request, use one of the following methods:
-
Passing parameters to create or update an object: In this method, parameters must be passed as JSON object containing the right attribute names and values as key-value pairs. When you use this format, you should specify that you are sending a JSON object in the header. This is done by setting the
Content-Type
header toapplication/json
. This ensures your request is executed accurately. -
Passing parameters to filter response of GET requests: Using this method, parameters can be passed using standard query attributes. In this method, the parameters would be embedded into the URI itself by appending a
?
to the end of the URI and then setting each attribute with an equal sign. Attributes can be separated with a&
. Tools likecurl
can create the appropriate URI when given parameters and values; this can also be done using the-F
flag and then passing the key and value as an argument. The argument should take the form of a quoted string with the attribute being set to a value with equal sign.
Example
Pass Parameters as a JSON object
curl -X POST "https://api.simplystack.com/v1/stacklets" \
-H "Content-Type: application/json" \
-H "Authorization: Token $TOKEN" \
-d '{"name": "test", "region": "fra"}'
Pass Filter Parameters as a Query String
curl -X GET "https://api.simplystack.com/v1/stacklets?region=fra" \
-H "Content-Type: application/json" \
-H "Authorization: Token $TOKEN"