ORIGINAL POST
Trying to use the save requisition list REST API endpoint. The API docs are not very clear on what the values should be and currently don't have access to the B2B module code to see what it exactly needs for the JSON input.
So, has anyone used this endpoint before? What would be a working example JSON? Am I even supposed to use this endpoint?
Endpoint Example (POST method): https://magento-store.com/index.php/rest/V1/requisition_lists
Example of what I have used:
{
"requisitionList": {
"id": 0,
"customer_id": 215120,
"name": "My List A",
"updated_at": "2019-05-06T15:49:00",
"description": "None",
"items": [
{
"id": 1,
"sku": 20410320,
"requisition_list_id": 0,
"qty": 10,
"options": [],
"store_id": 1,
"added_at": "2019-05-06T15:49:00",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}
Example Responses (2 of them):
{
"message": "Could not save Requisition List"
}
{
"message": "Internal Error. Details are available in Magento log file. Report ID: {error-id}"
}
UPDATE
It seems that not all the JSON fields are required as pointed out in the comments. I am now able to update an existing requisition list if I have the requisition list ID. I guess now does anyone know how to create a brand new list for a customer?
Request:
{
"requisitionList": {
"id":755,
"customer_id": 215120,
"name": "My List E",
"items": [
{
"sku": 16740700,
"qty": 3,
"store_id": 1
}
]
}
}
Response:
{
"id": 755,
"customer_id": null,
"name": "My List E",
"updated_at": "1557246976",
"description": null,
"items": [
{
"id": 1316,
"sku": "16740700",
"requisition_list_id": 755,
"qty": 3,
"options": [],
"store_id": 1,
"added_at": null
}
]
}