Sync distribution files from SFTP to REST API

Recipe ToolsMarketingFile TransferData ParserUtilitiesDeveloper ToolAPI Integration

What it does

When a scheduled interval arrives, this automation downloads distribution, line, and header files from the SFTP server. Each XML file is parsed and sent to the REST API, and someone receives a job report log so they know the sync completed.

Who it's for

Operations teams who need to move purchase order files from the SFTP server to an API on a schedule without manual downloads.

How teams use this

Automate nightly purchase order syncs

Run the file download and parse on a nightly schedule so purchase orders from the SFTP server reach the REST API without someone manually downloading and uploading each file.

Route files to different API endpoints

Send distribution, line, and header data to separate REST API endpoints instead of one, so each file type is processed by the system designed for it.

Add validation before sending to API

Include a condition to check that parsed XML data meets required fields before the REST request is sent, so incomplete records do not reach the REST API.

How it works

  1. Run on a specified interval. This automation starts at the scheduled time you set, such as daily or weekly, so files sync without someone triggering it manually.
  2. Download distribution, line, and header files. Retrieve three XML files from the SFTP server: the distribution file, the line file, and the header file so all data is ready to parse.
  3. Parse each XML document. Extract the data from all three XML files so the content is ready to send to the REST API endpoint in the correct format.
  4. Format data into message templates. Create three separate messages using the PR-Dist, PR-Line, and PR-Header templates so each file type is formatted for the API.
  5. Send data to REST API. Post the three formatted messages to the REST API endpoint so the purchase order records are created or updated in the target system.