Create VirtoCommerce custom API endpoint with VC platform API Authentication - virtocommerce

like the title says, I want to extend the VC platform API endpoints with the built in API Authentication (via the API key).
I followed the tutorial to create a managed module, and I can successfully make the API calls. However, it doesn't include any authentication. I am wondering how would I accomplish this?
Another question is that in order to have the VC Storefront to use my custom API endpoints, I would have to generate the module API using the AutoRest on the VC Storefront project, correct?
Thnak you all in advance!

VC uses platform API with APIRequestHandler, that uses ApppId and SecretKey to add header to every API request:
request.Headers.Authorization = new AuthenticationHeaderValue("HMACSHA256", signature.ToString());
Then handler is used by every endpoint - link to code.
More info on authentication could be found here:
Working with platform API.
Another question is that in order to have the VC Storefront to use my custom API endpoints, I would have to generate the module API using the AutoRest on the VC Storefront project, correct?
Yes, correct.

Related

Unity Agora APIS Callign issue

How create base64 key and added in this project , or what i pass in header id password in unity Webrequest by which access a restful api of agora , please help me .
Can you elaborate what RESTful APIs you are trying to use here? For the client side logic, the SDK should have sufficient set of API methods provided by the agora engine. If there is something that is only available in the RESTful API, it is probably better to implement on your Server side of the code.
This documentation contains the information about the RESTful APIs.

How to update API in API in API Manager?

I created a RAML file in API Design, then deployed in API manager and implemented in API runtime manager. It is clear no issues now.
Now i got change in raml file. I did changes in API Design and published into exchange with v2.
The problem here is how to import the v2 API into API manager ?
after importing the new api do i need to add all policies applied on v1 API to v2 API again ?
or is there any automatic option ?
I don't find any options in API manager, please help me..,
Yes, we need to apply policies again. Even when there is the same API version have 2 instances.
If you do not have major change then you can just go to action and upgrade to next assent version of the same API. Else you need to apply policies.
Ranveer

How to integrate rest Api with Magento

Hello I have Third Party REST API And I want to integrate that REST API with my Magento Project
so, is that Possible in Magento??
And If Yes then how to integrate it in my Magento Project
Please Help......
Thank in advance
Yes,
Magento has a REST API, more usually with Soap Client.
Some examples: http://www.magentocommerce.com/api/soap/introduction.html
Try to use last version (V2) of integration and get attention for examples that is for V2 Magento API.
First you need to create user to consume this API:
Magento Admin -> System -> Web Service -> SOAP/XML Users
and create your user for get api integration functionality.

Authenticating WEB API and knockout Js view model

I am trying to create secured MVC4 web API project. In this application knockout Js will access API service directly. I need authentication on his. I am confused how to apply authentication only on web api. I can’t use MVC authentication because other projects also share same API services.
Any one please suggest a good solution using knockout js and web api. I tried Thinktecture.IdentityModel but I am not able to use knockout Js in it.
this project is in .net 4.0.
Thanks in advance
thanks for the support
got solution
Use the [Authorize] attribute on the WebApi controllers
[Authorize(Roles="WebApiAccess")]
public class FooController : ApiController
{
}
You can send authN tokens before your Ajax request. Here is a similar SO question (with answer). You can add auth for your entire client app by creating a global 401 error handler (AngularJS, but the original question is generic jQuery).

Can we use REST API and custom templates?

I'd like to create a website with authentication using REST framework. Well I'd not like to use it because I didn't understand everything about it, but I have to.
Can I use the REST API and yet have custom templates for administration and simple browsing ?
What I mean is that when I did the REST tutorial (on their website), I didn't see at all where I could put my templates instead of the ones generated by REST. How can I for example use the authentication of REST with my interface, my web template ?
Cannot figure out what do you mean by custom templates ?
Incase you want to begin with REST then you may start with jersey framework. For Security you may use OPenID or the latest OAuth2.0 specs
Here is my tutorial for REST + OAuth2.0
http://restful-fundamentals.blogspot.in/2013/02/rest-and-http.html
http://restful-fundamentals.blogspot.in/2013/04/oauth-20-introducation.html
Google code repo: http://restful-fundamentals.blogspot.in/2013/04/svn-repository-oauth20-spectifications.html