Core Service
The Core PIA workflow service exposes APIs for integration with another service or application.
Document Manager
The document manager handles various operations relating to your files/documents.
Store Document
You can use this API to push the documents to PIA, which will then automatically create entries in your company file. It returns the information related to the new document added.
Limitations
- The file can not be larger than 50MB.
- You can upload a file of any type but only PDF, JPG and PNG files will be processed by PIA.
- The context is not validated. The document will still be processed if the context is incorrect but will not appear in your company file.
- You can only upload one file at a time.
Authentication
To authenticate with this API you will need an API key, see Get Started and Get API Key for details.
URL
POST https://api.cegid.com/loop-api-publiques/storeDocument?context={context}&filename={filename}[&uploadAuthor][&uploadMode][&collectionStage][&transaction]
Example:
POST https://api.cegid.com/loop-api-publiques/storeDocument?context=CONTEXT1&uploadAuthor=user1@domain.fr&filename=test1.pdf
Parameters
Param | Description | Required | Default | Example |
---|---|---|---|---|
context | Code of company file | yes | CEGID001 | |
filename | Name of the file to store | yes | newDocument.pdf | |
uploadAuthor | Email address of the user uploading the document | no | user@domain.fr | |
uploadMode | Override the upload mode ("API", "E-mail", "Libeo", "Mobile", "Regate", "Sharepoint" or "Transformed") | no | "API" | Mobile |
transaction | Transaction direction of the invoice ("PURCHASE", "SALE") | no | SALE |
Headers
Header | Description | Example |
---|---|---|
Content-Type | The MIME type of the file you are uploading | One of: - "application/pdf" - "image/jpeg" - "image/png" |
x-apikey | The API key to authenticate with this API, see Authentication | my_secret_api_key |
Content
Field | Description |
---|---|
"Content-Type" Header | One of: - "application/pdf" - "image/jpeg" - "image/png" |
Data | File to send, type: pdf/jpeg/png |
Response
Example
{
"context": "CEGID001",
"domain": "DOMAIN",
"documentId": "4c903972-97b5-4edd-8ef2-4bcfb9f109e0",
"status": "W",
"originalDocumentId": "51c2b92d-eecb-4702-b5b2-ae0260ac2df0"
}
Response Fields
Field | Type | Description |
---|---|---|
context | string | Code of company file |
domain | string | Domain the document was stored in to |
documentId | string($uuid) | Unique ID of the document |
status | "C" or "W" | Status of the document |
originalDocumentId | string($uuid) | If the document is a duplicate (status = W), then it will be the id of the original document that this is a duplicate of |
Document status
Code | Description |
---|---|
C | Collected successfully and PIA is processing the document |
W | The document is a duplicate of another document, no processing will be done |
Error example
In this example, you have missed the required fields "context", or "filename"
{
"stack": "Error: Parameters context and filename are mandatory (...)",
"message": "Parameters context and filename are mandatory"
}