Import Holidays

Import holidays from a CSV file.

Steps to import holidays

Request URL

POST {base_url}/{api_path}/holidays/import?access_token={access_token}

Request parameters

Parameter Required Type Description
file Yes File The CSV file containing the holidays to import.
format Yes String The format of the file to import.

Valid value:

  • csv: CSV format.
extend Yes String The time zone associated with the holidays.
Note: You can query time zone ID using the Query Time Zone List interface.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
error_file_url String The download URL of the file containing the records that failed to import. This field is returned with values only if any records fail to import.
fail_number Integer The number of records that failed to be imported.
succ_number Integer The number of records imported successfully.
total_number Integer The total number of records in the imported file.

Example

Request example

POST /openapi/v1.0/holidays/import?format=csv&access_token=gwakjgu9ZBUfz36wql4ndsVKkryI0kdj HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com
Content-Type: multipart/form-data; boundary=----Boundary123

------Boundary123
Content-Disposition: form-data; name="file"; filename="holidays.csv"
Content-Type: text/csv

Name,Holiday Type,Date
{holiday_name},{holiday_type},{DD/MM/YYYY HH:MM}
------Boundary123
Content-Disposition: form-data; name="format"

csv
------Boundary123
Content-Disposition: form-data; name="extend"

{timezone_id}
------Boundary123--

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "submsg": "",
    "total_number": 1,
    "succ_number": 1,
    "fail_number": 0,
    "error_file_url": ""
}