REST Services for Retrieving Documents

Dayforce RESTful Web Services Developer Guide

Version
R2025.2.1
ft:lastPublication
2025-11-05T18:19:39.327058
REST Services for Retrieving Documents

The following topics describe the foundational concepts and methods for retrieving documents using RESTful Web Services:

URL Endpoint

The base URL for the Document API is as follows, where you replace <clientName> with the name of your organization:

https://www.dayforcehcm.com/api/<clientName>/v1/Documents

Documents API Proxy Class

This class is a proxy class provided to act as a façade on top of the REST layer. Using this class is optional. Note that the examples in this topic provide the pure raw REST request and response details, but the sample code uses the DocumentsApi class.

In your application, you’ll want to instantiate the DocumentsApi class using either the root URL or the target redirect URL that will be embedded in a URI object. Here is code that demonstrates instantiating the DocumentsApi class:

Code for the DocumentAPI class.

Retrieve List of Documents Based on Employee

The following function will retrieve a list of information about each document associated with an Employee’s XRefCode. The information contains metadata about each document. The content of each document will not be available in this function, but the DocumentGUIDis. The DocumentGUID is the unique identifier needed to retrieve the document in the Retrieve a Single Document function.

GET https://www.dayforcehcm.com/api/<clientName>/v1/Documents/?EmployeeXRefCode=123

Body:

{
"DocumentGUID": "24f4f5d6-3b57-4220-a47c-a01abc4a16fb",
"DocumentName": "850qa2 Document count - before.jpg",
"DocumentType": 
{
"ShortName": "Address",
"Description": "Address",
"XRefCode": "ADDRESS"
},
"FileName": "850qa2 Document count - before.jpg",
"UploadedDate": "2017-03-24T14:59:56.617",
"UploadedBy": 
{
"LoginId": "CAdmin"
}
}

Sample Code: Retrieve List of Documents Based on Employee

The following screenshot shows the sample code used to retrieve a list of documents:

Sample code to retrieve documents.

Retrieve a Single Document

The following function will retrieve a single document based on a unique DocumentGUID. The response contains two parts: the metadata and the content.

The metadata contains information about the name of the file, file type, and publishing date.

The content data is stored as a BLOB in the database and then converted as a base 64-byte array when it's retrieved by the web services request. To make the contents usable by a reader, it must be deserialized. An example of deserialization is available in the sample application code. The document location is set as the root of the sample application as a default.

GET:  https://www.dayforcehcm.com/api/<clientName>/v1/Documents/123

Body:

{
"DocumentGroup": "DocumentManagement",
"SourceReportUniqueId": "e2e34a25-169e-4784-996d-3d5c43cafe6f",
"PublishDateTime": "2017-04-11T11:59:18.727",
"Title": "Message Response Mockups.pdf",
"PageCount": 0,
"CultureId": 0, 
"Contents": "JVBERi0xLjQKJafj8fEKMSAwIG9iago8PAovVHlwZSA…”
"FileName": "Message Response Mockups.pdf",
"SizeBytes": 141876 
}

Sample Code: Retrieve and Save a Single Document

The following figure shows the sample code used to retrieve and save a single document:

Sample code used to retrieve and save a single document.

Sample Code - Saving Function for a Single Document

The following figure shows the sample code for the saving function of the single document:

Sample code for the saving function of the single document.