This topic explains the Export API workflow:
Note: This workflow explains a usual course of export functionality and does not include exceptional scenarios.
-
A user selects specific accounting entries for export from Pleo to an external ERP/accounting system.
-
The accounting entries are transformed to exportable data items and packaged as export items.
-
At this stage, an export job is initiated in the
pendingstatus. -
If the external ERP/accounting system sends a request to the
GET Get a list of Export Jobswithcompany_idandpendingstatus in the query parameters, the endpoint response sends a list of export jobs awaiting in thependingstatus; the endpoint response also contains the corresponding export job IDs.
If no export job is available in thependingstatus, no response is sent. -
The export job now begins to transfer the export items from Pleo to the ERP/accounting system.
-
Simultaneously, the external ERP/accounting system sends a request to the
POST Create Export Job Eventendpoint withstartedas the value foreventparameter.This changes the state of the
pendingexport job toin_progressstate. -
At the end of the export, the export job could have either of the following status:
failed: The export items could not be transferred to the ERP/accounting system. If the export job hasfailed,failureReasonandfailureReasonTypeare additional parameters that the ERP/accounting system specify while sending a request to thePOST Create Export Job Eventendpoint to update the status of the corresponding export job.completed: The export job is successfully completed and all the export items have been transferred to the ERP/accounting system.completed_with_errors: Some export items have been exported, while some could not.Note: If the export job hascompletedstatus, each accounting entry is assigned anexportedAt,externalId, andexternalUrl- this information is returned in theGET Get Export Job Itemsendpoint response.
The Pleo application also accordingly updates the export workflow status:
- All successfully exported accounting entries are moved to the Exported tab.
- The accounting entries that could not be exported remain in the Export queue.
Note: A couple of important pointers:
- If the external ERP/accounting system sends a request to the
GET Get Export Itemsendpoint, specifying a certain export job ID, it returns a list of accounting entries that have been selected for export in a specific export job. The endpoint response informs you about the accounting entries that are selected for export in an export job.- Send a request to the
PUT Update Export Job Itemsto modify details of accounting entries that either have been successfully exported to the ERP/accounting system (forsuccessfulstatus), not yet exported (forpendingandin_progressstatus), or not exported (forfailedandabandonedstatus).