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
pending
status.
Note: If the external ERP/accounting system sends a request to the
GET Get a list of Export Jobs
withcompany_id
andpending
status in the query parameters, the endpoint response sends a list of export jobs awaiting in thepending
status; the endpoint response also contains the corresponding export job IDs. If no export job is available in thepending
status, an empty list is returned.
- The ERP/accounting system triggers a request to the
POST Create Export Job Event
endpoint withstarted
value for theevent
parameter. This changes the state of thepending
export job toin_progress
state. - The export job now begins to transfer the export items from Pleo to the ERP/accounting system.
- 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
,failureReason
andfailureReasonType
are additional parameters that the ERP/accounting system specify while sending a request to thePOST Create Export Job Event
endpoint 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 has
completed
status, each accounting entry is assigned anexportedAt
,externalId
, andexternalUrl
- this information is returned in theGET Get Export Job Items
endpoint response.
Note: A few important pointers:
- The accounting entries that could not be exported remain in the Export queue.
- If the external ERP/accounting system sends a request to the
GET Get Export Items
endpoint, 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 Items
to modify details of accounting entries that either have been successfully exported to the ERP/accounting system (forsuccessful
status), not yet exported (forpending
andin_progress
status), or not exported (forfailed
andabandoned
status).
Diagrammatic Representation
Here is a diagram to help you understand the Export API workflow: