Purchase Drafts
German: “Ausgaben – Entwürfe”
- Attributes
- GET /purchases/drafts
- POST /purchases/drafts
- GET /purchases/drafts/{id}
- GET /purchases/drafts/{id}.pdf
- DELETE /purchases/drafts/{id}
Attributes
The purchase draft representation is:
{
"id": 123,
"title": "Ticket",
"email_from": "john@example.com",
"email_body": "here the ticket",
"user": {
"id": 933590696,
"firstname": "John",
"lastname": "Doe"
},
"file_url": "https://...",
"net_total": 100.00,
"gross_total": 119.00,
"created_at": "2021-10-17T09:33:46Z",
"updated_at": "2021-10-17T09:33:46Z"
}
GET /purchases/drafts
Retrieve all drafts:
curl -X GET \
'https://{domain}.mocoapp.com/api/v1/purchases/drafts' \
-H 'Authorization: Token token=YOUR_API_KEY'
This returns an array with complete draft information (see attributes).
The following parameters can be supplied:
POST /purchases/drafts
Create a purchase draft:
curl -X POST \
'https://{domain}.mocoapp.com/api/v1/purchases/drafts' \
-H 'Authorization: Token token=YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "Supplier invoice draft",
"file": {
"filename": "invoice.pdf",
"base64": "JVBERi0xLjQK..."
}
}'
Mandatory fields are: title.
Fields:
- title – Title of the purchase draft (required)
- file – Optional file attachment with properties:
- filename – Original file name including extension
- base64 – Base64-encoded file content
GET /purchases/drafts/{id}
Retrieve a single draft:
curl -X GET \
'https://{domain}.mocoapp.com/api/v1/purchases/drafts/{id}' \
-H 'Authorization: Token token=YOUR_API_KEY'
The response is a single draft representation.
GET /purchases/drafts/{id}.pdf
Retrieve the draft document:
curl -X GET \
'https://{domain}.mocoapp.com/api/v1/purchases/drafts/{id}.pdf' \
-H 'Authorization: Token token=YOUR_API_KEY'
This returns this draft’s document if it’s a PDF. Otherwise it responds with 204 No Content.
DELETE /purchases/drafts/{id}
Deletes a purchase draft.
curl -X DELETE \
'https://{domain}.mocoapp.com/api/v1/purchases/drafts/{id}' \
-H 'Authorization: Token token=YOUR_API_KEY'