API Methods
For Retrieving Data
HTTP GET
Use the HTTP GET method to retrieve data from the database. This includes both lists and individual records. For example, following is the cURL you would use to retrieve an individual activity.
For Creating and Updating data
There are three request methods you can use to edit and add records in the database: HTTP PUT, PATCH and POST.
HTTP PUT
Use the PUT method to update an existing entry using the complete model in the database. Cost Rate, Bill Rate and Overtime Bill Rate has been updated with new values in the example below.
HTTP PATCH
Use the HTTP PATCH method to update a resource using a partial model in the database. Sending the complete resource representation might be cumbersome and utilizes a lot of unnecessary bandwidth. In such cases, the use of PATCH is highly recommended. Note that CORE APIs do not support the PATCH method to update any nested objects (sub-models). customFields is the only nested object that you can update using PATCH. Check out this article for more details.
HTTP POST Methods
HTTP POST Individual
Use the POST method to add a single entry to the database. For example, you might use the POST method to add an activity to the company file.
HTTP POST Batch
Use the HTTP POST BATCH method to save multiple resources in the database. Batch API facilitates the logical bundling of multiple resources via a simplified interface.
The body of a bulk operation contains a set of resources, which the API schedules for execution and returns job as a response. A successful BATCH request returns the status code 202.
To retrieve the status of a batch, use the GET request.
For Deleting data
HTTP DELETE
Use the DELETE method to remove an entry from the database. For example, you might want to use DELETE to remove an activity from the database. You will require its activity id and the following query.
When to use?
- use HTTP GET method to retrieve existing record or records
- use HTTP POST method to add a new record
- Use the HTTP POST BATCH method to save multiple resources in the database
- use HTTP PUT method to edit an existing record by sending a complete object
- use HTTP PATCH method to edit an existing record by sending a partial object
- use HTTP DELETE method to remove an existing record