0

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 2

0

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

Postman

Sign up to request clarification or add additional context in comments.

5 Comments

What should i add in body to get category list
I get response mentioned above. Didn't get category list.
can you share your code and postman screen. Maybe, your code is wrong. I just guesses
I added image. I don't know what to add in body content. Is anything I missed in this request?
oh. I see.Sorry. I cant help. You shoud reseach for magento rest api and how to use postman to test api.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.