1

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?

Doc link: https://devdocs.magento.com/redoc/2.3/async-admin-rest-api.html#operation/requisitionListRequisitionListRepositoryV1SavePost

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
        }
    ]
}
  • you can remove id since it has to be dynamically created then make sure you have store with store id 1 – fmsthird May 6 at 21:48
  • @magefms Thanks, I will try that. I had it included in the JSON as the docs labeled it as required. – Henry Nitz May 7 at 16:28
  • 1
    @magefms That seemed to work for updating a list. I've updated the post. Any ideas/information on creating a new list for a customer? Thanks. – Henry Nitz May 7 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.