Products REST API
API request #index
GET /products.xml or /products.json
GET /projects/
Example:
GET https://www.demo.redmineup.com/products.json
Response:
{"products": [ {"id":7, "code":"consult", "name":"Redmine consulting", "price":"75.0", "currency":"USD", "description":"", "category":{"id":2,"code":"001/1","name":"Service"}, "project": {"id":12,"name":"Redmine Products plugin demo"}, "status_id":1, "author": {"id":4,"name":"Smith Paul"}, "tag_list":[], "custom_fields": [{"id":17,"name":"Vendor","value":"45"}], "created_at":"2014-10-28T22:16:55Z", "updated_at":"2014-10-28T22:19:53Z"}, {"id":4, ........... ........... }, .... ], "total_count":6, "offset":0, "limit":25 }
API request #show
GET /products/
GET /projects/
Example:
GET https://www.demo.redmineup.com/products/4.json
Response:
{ "product": { "id": 1, "image": {"attachment_id": 44}, "code": "001P", "name": "CRM plugin", "price": "99.0", "currency": "USD", "description": "This is a product CRM description", "category": {"id": 2,"code": "001/1","name": "Service"}, "project": {"id": 12,"name": "Redmine Products plugin demo"}, "status_id": 1, "author": {"id": 11,"name": "Kutcher Ashton"}, "tag_list": ["CRM","plugin","pro"], "custom_fields": [ {"id": 17,"name": "Vendor","value": null} ], "created_at": "2013-09-11T10:22:38Z", "updated_at": "2014-10-28T22:21:20Z" } }
API request #create
POST /products.xml or /products.json
POST /projects/
Example:
POST https://www.demo.redmineup.com/products.json?key=9a1acbd3a18eb1370 { "product": { "name": "Redmine cookbook", "price": "50.0", "currency": "USD", "description": "This is a book ", "status_id": 1, "project_id": 12 } }
Note: Required parameters: name, status_id where status_id: 1 - Active, 2 - Inactive.
Response:
{ "product": { "id": 8, "code": null, "name": "Redmine cookbook", "price": "50.0", "currency": "USD", "description": "This is a book ", "project": {"id": 12,"name": "Redmine Products plugin demo"}, "status_id": 1, "author": {"id": 4,"name": "Smith Paul"}, "tag_list": [], "custom_fields": [ {"id": 17,"name": "Vendor","value": null} ], "created_at": "2023-06-05T06:59:21Z", "updated_at": "2023-06-05T06:59:21Z" } }
API request #update
PUT /products/<product_id>.json { "product": { "name": "Redmine cookbook 2nd edition", "price": "100.0", "description": "This is a updated book" } }
Example:
PUT https://www.demo.redmineup.com/products/1.json?key=9a13f3 { "product": { "price": "100.0", "description": "This is a updated plugin" } }
API request #delete
DELETE /products/
Example:
DELETE https://www.demo.redmineup.com/products/10.json?key=9a13f3
Orders REST API
API request #index
GET /orders.xml or /orders.json
GET /projects/
Example:
GET https://www.demo.redmineup.com/orders.json
API request #show
GET /orders/
GET /projects/
Example:
GET https://www.demo.redmineup.com/orders/21805.json
API request #create
POST /projects/
POST /orders.xml or /orders.json
Example:
POST https://www.demo.redmineup.com/orders.json { "order": { "number": "SO-0047", "subject": "Sales order for plugin Products", "order_date": "2023-05-16", "currency": "USD", "project_id": 12, "lines_attributes": { "0": {"description":"Test","quantity":"2","price":"10"}, "1": {"product_id":"1","quantity":"2","price":"100","tax":"10","discount":"10"} } } }
Note: Required parameters: number, order_date, project_id.
API request #update
PUT /orders/<order_id>.xml or /orders/<order_id>.json { "order": { "subject": "New subject for order #29" } }
Example:
PUT https://www.demo.redmineup.com/orders/14.json { "order": { "lines_attributes": { "3": {"product_id":"2","quantity":"5","price":"156","tax":"10","discount":"10"} } } }
API request #delete
DELETE /orders/
DELETE https://www.demo.redmineup.com/orders/14.json