Managing the Pay Schedule
The pay schedule is used to group employees who are paid on the same frequency and day.
See the [Reference Data] for a complete breakdown of all the pay schedule properties.
Supported HTTP methods are:
[GET] Pay Schedule
This example demonstrates how to [GET] an existing pay schedule instance.
Pay schedules are stored under the employer object.
You can access the links to all employer pay schedules using the /Employer//PaySchedules url.
curl -X GET \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/xml' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/xml'
curl -X GET \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/json' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/json'
Response Example
<?xml version="1.0"?>
<PaySchedule xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>My Monthly</Name>
<PayFrequency>Monthly</PayFrequency>
</PaySchedule>
{
"PaySchedule": {
"Name": "My Monthly",
"PayFrequency": "Monthly"
}
}
[POST] a new Pay Schedule
This example demonstrates creating a new pay schedule using a [POST].
When performing a [POST] the API will generate default resource location unique keys.
Default pay schedule unique key pattern is:
- SCH001
- SCH002
- etc...
curl -X POST \
'https://api.test.payrun.io/Employer/ER001/PaySchedules' \
-H 'Accept: application/xml' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/xml' \
-d '<?xml version="1.0"?>
<PaySchedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>My Monthly</Name>
<PayFrequency>Monthly</PayFrequency>
</PaySchedule>'
curl -X POST \
'https://api.test.payrun.io/Employer/ER001/PaySchedules' \
-H 'Accept: application/json' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/json' \
-d '{
"PaySchedule": {
"Name": "My Monthly",
"PayFrequency": "Monthly"
}
}'
Response Example
The [POST] response is a link to the newly generated resource.
<?xml version="1.0"?>
<Link
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
title="SCH001: [My Monthly:Monthly]"
href="/Employer/ER001/PaySchedule/SCH001"
rel="PaySchedule"
/>
{
"Link": {
"@title": "SCH001: [My Monthly:Monthly]",
"@href": "/Employer/ER001/PaySchedule/SCH001",
"@rel": "PaySchedule"
}
}
[PUT] a Pay Schedule
This example demonstrates creating a new pay schedule using [PUT]. You can use [PUT] to create new and updated existing objects.
When performing a [PUT] you specify the resource location including the unique key.
By specifying your own unique keys you can use your own resource management naming conventions.
Example:
- /Employer//PaySchedule/MyScheduleKey
- /Employer//PaySchedule/AnotherScheduleKey
curl -X PUT \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/xml' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/xml' \
-d '<?xml version="1.0"?>
<PaySchedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>My Monthly</Name>
<PayFrequency>Monthly</PayFrequency>
</PaySchedule>'
curl -X PUT \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/json' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/json' \
-d '{
"PaySchedule": {
"Name": "My Monthly",
"PayFrequency": "Monthly"
}
}'
Response Example
The [PUT] response is the entire updated resource.
<?xml version="1.0"?>
<PaySchedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>My Monthly</Name>
<PayFrequency>Monthly</PayFrequency>
</PaySchedule>
{
"PaySchedule": {
"Name": "My Monthly",
"PayFrequency": "Monthly"
}
}
[DELETE] a Pay Schedule
This example demonstrates deleting a pay schedule using the [DELETE] verb.
You cannot delete a pay schedules that have dependent pay runs.
curl -X DELETE \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/xml' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/xml'
curl -X DELETE \
'https://api.test.payrun.io/Employer/ER001/PaySchedule/SCH001' \
-H 'Accept: application/json' \
-H 'Api-Version: default' \
-H 'Authorization: {OAuthHeader}' \
-H 'Cache-Control: no-cache' \
-H 'Content-type: application/json'