buddha-code / buco-order-documents-api
Shopware plugin which adds a REST API endpoint to access and delete order documents
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:shopware-plugin
pkg:composer/buddha-code/buco-order-documents-api
Requires
- php: >=7.0
- composer/installers: ^1.0
This package is auto-updated.
Last update: 2020-08-27 10:19:44 UTC
README
Shopware plugin which adds a REST API endpoint to access and delete order documents.
Features
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/pdfin 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 }
Feature Ideas
- Implement POST and PUT methods
POSTGenerate document via ShopwarePOSTUpload externally generated documentPUTmanipulate meta data like amount and attributesPUTupload PDF file
Compatibility
- Shopware >= 5.2.0
- PHP >= 7.0
Installation
Git Version
- Checkout plugin in
/custom/plugins/BucoOrderDocumentsApi - Install and active plugin with the Plugin Manager
Install with composer
- 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
Contributing
Feel free to fork and send pull requests!
Licence
This project uses the GPLv3 License.