skip to Main Content

enter image description hereI am new to magento and trying to get response from magento rest api but I can’t.

Initially I get authorization key by passing username, password

Now I want to list all categories.

In Authorization I used Bearer Token, In Headers Content-Type:application/json but I got

{
    "message": ""%fieldName" is required. Enter and try again.",
    "parameters": {
        "fieldName": "category"
    }
}

I am trying to get category list. Is anything I should pass in body?

2

Answers


  1. Yes. You should pass data json in body. see image.

    Postman

    Login or Signup to reply.
  2. First of all must have user and password of Magento Repository.
    For bring them, login in Magento Marketplace, Click your account name in the top-right of the page and select My Profile, click Access Keys in the Marketplace tab.

    Click Create a New Access Key. Enter a specific name for the keys and click OK.
    Use the Public key as your username and the Private key as your password.

    Now we can call our first root, insert in the url input the url below and as method select “POST”:

    http://yourdomain.com/rest/V1/integration/admin/token?username=developer.beprime&password=)K!mMcq2rVW (autenticazione) ( no-auth )
    From this call Magento answer wit a token, es: “e18te890ntzj0eww19mglsvhsremyny4”.

    You must copy and paste this token in “Authorization” tab, by selecting in select box (TYPE) on left “Bearer Token”.

    Now in the url input insert https://yourdomain.com/rest/V1/customers/1954
    (last parameter is the user id for witch you want have API, you find it in Magento Admin under “customers” menu ), and as method select “GET”

    Ince Magento answer with the customer json, you can download it ( by click on “download” button ), or you can save the call for future quick access ( button “save” ).

    For show all Magento root: https://yourdomain.com/swagger

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search