Dayforce follows the REST standards regarding the use of HTTP verbs to retrieve and update data. Below is a description of the verbs that are currently supported.
GET
GET is used to retrieve resource data, with responses in JSON format. Resources can be retrieved individually by using an XRefCode or as collections if an XRefCode isn’t specified.
PATCH
PATCH is used to make changes to existing resources. The query string indicates which resource to update by specifying an XRefCode, and the request body contains the data. The data in the request body has the same structure as the response from the GET request.
Null and Missing Properties on the Request
It is important to understand how a null value on the request is treated differently from a property that is missing on the request. Failing to understand the difference could cause unintentional data changes.
The standard use case is to provide only the property values that you need to change. Excluding a property from the request implies that you don’t want to change the value of that property in the Dayforce database.
If you include properties with a value of Null in the request, the REST service will update the corresponding property in the Dayforce database to Null.
While the above seems simple and intuitive, you must be careful when producing the request JSON from the response body because some JSON APIs will produce null valued properties in the output by default. The sample app has been coded to handle this situation.
As an example, suppose you need to change the last name of an employee and also remove their home phone number. The request for this follows where any employee property not shown in the request remains unchanged, but the HomePhone value is removed from the database.
{
"HomePhone":null,
"LastName":"newName",
"MaidenName":"priorName"
}
POST
POST is used to add new entities to the system. This should be familiar as it's the same process used by web browsers to submit form data to a web server.
Like updating a resource with a PATCH request, the query string will indicate the XRefCode of the resource to add, and the request body will contain the data. The data in the request body has the same structure as the response from the GET request.
Note: XRefCodes must be unique. To add a new resource, you must come up with an XRefCode that is unique to that resource. Using an XRefCode that is already in use will result in an error when the data is validated.