# HTTP Methods
# The GET method
The GET method is used to obtain a data set from an API endpoint. Without any specified parameters
(detailed on next chapter) it will return all entries,
much like a SQL select * from statement.
Metadata is also provided with every response to the GET method, which you will use to parse through the returned data set.
# Example requesting all resources
GET https://api.gestal.cloud/integrator
Each endpoint supports a single-resource GET by supplementing a cloud_id to the URL.
# Example requesting a single resource
GET https://api.gestal.cloud/integrator/int_41soix4ZP9os2M1lsPzwlpbvqnqHJgYH
# The POST method
The POST method is used to send data to the API using a JSON payload containing the endpoint's resource required attributes.
# Example request
POST https://api.gestal.cloud/integration/sow-mirrors 'Payload: JSON <{sow_mirror}>'
where sow_mirror is the following JSON object:
{
"vendor_id": "abc123",
"pin_tag": "my sow",
"rfid1": 123456789,
"rfid2": 987654321,
"state": "farrowing",
"state_updated_at": "2020-05-09T14:56:15.550Z",
"last_location": "Pen 153"
}
# Example Response
Responses are returned to POST requests, providing a result code and a JSON object containing details. If the above request succeeds, the following will be returned:
201 Created
{
"cloud_id": "wos_41soix4ZP9os2M1lsPzwlpbvqnqHJgYH",
"vendor_id": "abc123",
"gestal_id": null,
"pin_tag": "my sow",
"rfid1": 123456789,
"rfid2": 987654321,
"state": "farrowing",
"state_updated_at": "2020-05-09T14:56:15.550Z",
"last_location": "Pen 153",
"location_updated_at": null,
"section": null,
"parity": 0,
"genetic": null,
"birth_at": null,
"entry_at": null,
"tattoo": null,
"dam": null,
"sire": null,
"adapted": false,
"accepted": false,
"batch": null,
"notes": null,
"created_at": "2020-07-14T14:38:49.328Z",
"updated_at": "2020-07-14T14:38:49.328Z"
}
in case of error, for example if the pin_tag attribute was not provided, the following is returned:
422 Unprocessable Entity
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "traceId",
"errors": {
"$.pin_tag": [
"The pin_tag field is required."
]
}
}
# The PATCH method
The PATCH method lets you update an existing resource. It works just like the POST, by the cloud_id of
the resource to be updated provided in the URL. Returns are the same in case of success or error.
# Example request
PATCH https://api.gestal.cloud/integrator/int_41soix4ZP9os2M1lsPzwlpbvqnqHJgYH 'Payload: JSON <{integration}>'
# The DELETE method
Self-explanatory, and works exactly as the PATCH method. Not all endpoints will support the DELETE method.
DEFINITIVE
Once something is deleted, it cannot be undone.