Shopware plugin which adds a REST API endpoint to access and delete order documents.
This plugin adds a new REST API endpoint to access and delete the order documents including
their attributes. Creating and modifying order documents it currently not implemented. The access to the endpoint can be restricted with the access
control list (ACL) resource BucoOrderDocuments
and the privileges read
and
delete
in the user manager.
The REST API can be accessed in the following ways:
-
GET /api/BucoOrderDocuments/
returns a listing. The well known limit, order and query parameters can be applied.Example output:
{ "data": [ { "id": 11756, "date": "2017-07-31T00:00:00+0200", "typeId": 1, "customerId": 6, "orderId": 1, "amount": 1598, "documentId": "55483", "hash": "7d2431092sadsa3a8047756edf0fec2da", "attribute": { // null, if no attributes available "id": 11668, "documentId": 11756, "someExampleAttribute": 42, } }, { ... } ], "total": 1337, "success": true }
-
GET /api/BucoOrderDocuments/{id}
returns a specific order document with a base64 encoded representation of the PDF document directly within the JSON response. To retrieve the PDF document directly without the meta data, include or set the MIME typeapplication/pdf
in the request headerAccept
.Example output (for JSON representation):
{ "data": { "id": 11756, "date": "2017-07-31T00:00:00+0200", "typeId": 1, "customerId": 6, "orderId": 1, "amount": 1598, "documentId": "55483", "hash": "7d2431092sadsa3a8047756edf0fec2da", "attribute": { // null, if no attributes available "id": 11668, "documentId": 11756, "someExampleAttribute": 42, }, "pdfDocument": "some random base64 encoded data[...]" // null, if file do not exist }, "success": true }
-
DELETE /api/BucoOrderDocuments/{id}
deletes a specific order document. Example output:{ "success": true }
- Implement POST and PUT methods
POST
Generate document via ShopwarePOST
Upload externally generated documentPUT
manipulate meta data like amount and attributesPUT
upload PDF file
- Shopware >= 5.2.0
- PHP >= 7.0
- Checkout plugin in
/custom/plugins/BucoOrderDocumentsApi
- Install and active plugin with the Plugin Manager
- Change to your root installation of Shopware
- Run command
composer require buddha-code/buco-order-documents-api
- Install and active plugin with
./bin/console sw:plugin:install --activate BucoOrderDocumentsApi
Feel free to fork and send pull requests!
This project uses the GPLv3 License.