To send and archive documents in batch, a distribution project
must be created. A distribution project consists of one or more spools of documents to be distributed (the distributions
), with each spool itself consisting of a series of named documents of the same type following a formatted determined in advance during the settings phase.
A typical project creation through the API includes the following calls:
Create a new project
with the POST /api/v1/distrib_projects/
method
Add one or more distributions
to this newly created project with the POST /api/v1/distrib_projects/:project_id/distributions/
method
The distributions
in the project
are automatically processed when uploaded
(optional) Receive callbacks for each completed distribution
(optional) Receive a callback when the project
is ready for validation (each distribution
has been succesfully completed). A URL is sent for a user to control the result of the processing
Validate the project
with the PUT /projects/:project_id/validate/
method to display documents in UKG HR Service Delivery, in the employee vaults, and send the paper campaigns.
This method creates a new project
Warning
This endpoint entered deprecation in July 2021. As per our deprecation policy, its sunset period started in January 2022 and retirement will occur in July 2022. Consider using the corresponding APIv2 endpoint instead.
POST /api/v1/distrib_projects/
Accept: application/json
Content-Type: application/x-www-form-urlencoded
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx
The POST is in form encoded data (Content-Type: application/x-www-form-urlencoded
):
Parameter |
Description |
Type |
mandatory |
Exemple |
---|---|---|---|---|
name |
The name of the project |
|
|
May 2014 Paystubs |
validation_option |
Identifier of validation options configuration. |
|
|
0 |
delivery_paper_conf |
Identifier of delivery paper configuration. |
|
|
no-paper |
regroup_paper_mailing |
Parameter used to group paper shipments. When sending multiple documents, one of the spools must be labeled as the main spool, the corresponding documents will then appear first in their respective packages |
|
no |
true |
group |
code identifying the distribution group that can access this project. |
|
no |
‘code’ |
package_sent_to_orgs |
True to send it to the employee’s organisations, False to send it to the adress defined in the project. |
|
no |
false |
tech_id |
Manager sender’s tech_id |
|
no |
‘abc123’ |
auto_validate |
True if you want to auto-validate the projects if all its distributions succeeded. |
|
no |
true |
package_first_name |
Project address for mailing. |
|
no |
Project’s address for mailing: first name. |
package_last_name |
Project address for mailing. |
|
no |
Project’s address for mailing: last name. |
package_address |
Project address for mailing. |
|
no |
Project’s address for mailing: address. |
package_address_2 |
Project address for mailing. |
|
no |
Project’s address for mailing: address 2. |
package_address_3 |
Project address for mailing. |
|
no |
Project’s address for mailing: address 3. |
package_postcode |
Project address for mailing. |
|
no |
Project’s address for mailing: postcode. |
package_city |
Project address for mailing. |
|
no |
Project’s address for mailing: city. |
package_country |
Project address for mailing. |
|
no |
Project’s address for mailing: country. |
package_contact |
Project address for mailing. |
|
no |
Project’s address for mailing: telephone number or email to contact in case of error. |
POST /api/v1/distrib_projects/
Content-Type: application/x-www-form-urlencoded
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx
Request body:
{
'name': "May 2014 Paystubs",
'validation_option': 0
'delivery_paper_conf': 'code'
'regroup_paper_mailing': true,
'group': 'code',
'package_sent_to_orgs': false,
'tech_id': 'abc123',
'auto_validate': true,
'package_first_name': "Jean",
'package_last_name': "Dupond",
'package_address': "12 rue Jean Jaurès",
'package_address2':"",
'package_address3': "",
'package_postcode': "75001",
'package_city': "Paris",
'package_country': "FR",
'package_contact': "[email protected]",
}
Curl example:
$ curl -H "X-API-KEY: XXXXXXXXXXXXXXX" -X POST \
> --data "name=Project&validation_option=0\
> &delivery_paper_conf=code" \
> https://example.com/api/v1/distrib_projects/
The response is encoded in the JSON format with the following parameters:
Parameter |
Description |
Type |
Example |
---|---|---|---|
project_id |
The id of the project (to be used to create |
|
1456151 |
msg |
Message about Information about the |
|
Project created on xxxx.peopledoc.com |
HTTP 200 OK
{
"msg": "Project created on xxxx.peopledoc.com",
"project_id": 6796789
}
HTTP/1.1 404 NOT FOUND
Content-Type: application/json
{
'errors': 'Project sender with tech id foo does not exists'
}
HTTP/1.1 400 BAD REQUEST
{
'errors': {
'delivery_paper_conf': ['Select a valid choice. That choice
is not one of the available
choices.']
}
}
This method adds a new distribution in a project
Warning
Since a file is transmitted in this method, this POST call must be encoded in multipart/form-data
.
POST /api/v1/distrib_projects/:project_id/distributions/
Accept: application/json
Content-Type: multipart/form-data
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx
Warning
All parameters must be encoded in form data:
Parameter |
Description |
Type |
mandatory |
Example |
---|---|---|---|---|
project_id (in the url) |
The |
|
|
42 |
source_file |
Binary file of the distribution (ZIP of PDFs / TXT / PDF containing all documents / …) |
|
|
|
name |
NAme of the distribution spool, displayed in the interface and used to identify the spool within a distribution project. |
|
|
|
distribution_type_type |
Identifier of the distribution type value. ‘code’ is the most likely. |
|
|
‘code’ |
distribution_type_value |
Value of the distribution type code, defined by the client with the project manager. |
|
|
‘payslips’ |
POST /api/v1/distrib_projects/6796789/distributions/
Accept: application/json
Content-Type: application/json
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx
Data parameter of the request body:
{
'name': 'May 2014 Paystubs',
'distribution_type_type': 'code',
'distribution_type_value': 'bsi',
'source_file': @path/file.pdf
}
Curl example:
$ curl -H “X-API-KEY: XXXXXXXXXXXXXXX” > -H ‘Content-type:multipart/form-data’ > -F “name=Distrib” -F “distribution_type_type=code” > -F “distribution_type_value=bsi” > -F ‘source_file=@path/file.pdf;type=application/pdf’ > https://example.com/api/v1/distrib_projects/42/distributions/
The response is encoded in the JSON format with the following parameters:
Parameter |
Description |
Type |
Exemple |
---|---|---|---|
distribution_id |
The id of the distribution |
|
42 |
msg |
Information |
|
‘Distribution May 2014 Paystubs is creating’ |
HTTP 200 Created
{
"msg": "Distribution May 2014 Paystubs is creating",
"distribution_id": 42
}
HTTP/1.1 404 NOT FOUND
Content-Type: application/json
{
'errors': 'Project not found'
}
HTTP/1.1 400 BAD REQUEST
Content-Type: application/json
{
'errors': {
'name': ['This field is required.']
}
}
This method creates a new project
POST /projects/6796789/validate/
Accept: application/json
Content-Type: application/json
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx
(The body of this POST is empty)
Parameter |
Description |
Type |
mandatory |
Exemple |
---|---|---|---|---|
project_id (GET) |
The id of the |
|
|
6796789 |
POST /projects/6796789/validate/
Accept: application/json
Content-Type: application/json
X-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx