How to test nopCommerce REST API provided by nop-template

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I am trying to consume API PLUGIN in one of my projects. Before moving forward, I want to test the API in Postman (A rest web service client). For this, I need a URL which I have to provide in Postman. Where do I get the URL of the API?

I already installed the API on one of my test deployment and its client is working fine and fetching the list of all customers.

Now the question is how I can test it in Postman? Which URL I have to provide to get the AccessToken and then the list of customers.
6 years ago
Hi,

Since you are using Postman you can get the token and use it for all requests by following these steps:
1. From the Authorization tab in Postman select OAuth 2.0 and click Get New Access Token
2. Auth URL: {Your store URL}/OAuth/Authorize
3. Access Token URL: {Your store URL}/api/token
4. Insert the Client ID and Client secret from the API Plugin.
5. Copy the Callback URL from the popup and paste it in the API Plugin and save the API plugin settings.
6. Click Request Token.

Once you have retrieved the token before making a new request select the token from the Authorization tab.

Regards,
Stoyan
6 years ago
Thanks Stoyan. The access token is fine now. I am able to retrieve it in Postman.


Now when I try http://localhost/api/products by selecting the received token, it says "Authorization has been denied for this request." Is there anything else I am missing?

{
    "Message": "Authorization has been denied for this request."
}
6 years ago
Hi,

Are you adding the token to the request header?

Please see the screenshots.




Regards,
Stoyan
6 years ago
Sorry, I forget to add the token to the request header. I got the response after adding it now.

Thank you.
5 years ago
How to Get Access Token using Nopcommerce UserID and Password?
5 years ago
tmanoharc wrote:
How to Get Access Token using Nopcommerce UserID and Password?

No, you won't use the Nopcommerce UserID and Password. you will have to create an Api Clients to get access token.
5 years ago
sanjib_nopDev wrote:
How to Get Access Token using Nopcommerce UserID and Password?
No, you won't use the Nopcommerce UserID and Password. you will have to create an Api Clients to get access token.


how can i create this in win form application?
5 years ago
Hello,

I am using the nop API plugin for version 4.10. So I not sure we can pass data to post method. I trying with the different format but how we can pass data in JSON?

I am using
/api/shopping_cart_items


how we can pass JSON DATAto post method?
5 years ago
Hello,

I am using the nop API plugin for version 4.10.
I follow  #193483.
When I click [Request Token] and then show up [Page Not Found].

I don't know what i'm miss.






Thank you.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.