Rest API to a Magento 2 Site - magento2

Is there a way to make a REST API call to a website built in Magento 2? The scenario is I have multiple site and the header of these sites are shared whether I go to website 1 or website 2. Now when I go to website 1 and select/add an item to the cart I would like this cart count to be available in the other websites. So I was thinking having an API call to a certain website then retrieve that value to be displayed.
But I'm not sure if this is the best approach or if there is available REST API resource I can use to retrieve information of a website data. Like if I'm in website 2 I would like to get the information of website 1 I would just send a REST request to retrieve this information.

Related

Get information about customer without password of user using the Shopware 6 REST API

I am trying to get information about a customer using the REST API of Shopware 6 (using this API). Therefor I need a ContextToken for that user. The only way to get a context token for a user is to log him in, but for that I need the password of a user which I do not have. Is there any way to get the ContextToken of a user with only his email address or hist customer id?
Shopware comes with 2 different APIs, the Store-API and the Admin-API. Refer to the docs.
The Store-API is there to build a storefront and thus you need to authenticate as the user using that API.
When you build custom integrations you should use the Admin-API, as that API can be used for CRUD-like operations on all entities of the system. For the admin API you can generate an API-Token and use it to query data of all customers.

Testing Pagination of Facebook Graph API

I need to test that I can fetch subsequent pages of reviews from facebooks graph API.
The issue I have is that an account can only review a page once, and pagination doesn't kick in til there are over 100 reviews.
Do I really need to create 101 user accounts and have each one of them manually submit a review, just so I can be sure that when real companies use the software I'll be able to fetch the paginated results correctly?
Is there an alternative?
The issue I have is that an account can only review a page once, and pagination doesn't kick in til there are over 100 reviews.
That’s just the default limit for that endpoint - but you can specify a different limit in your initial query (simply via the parameter of the same name, /page/ratings?limit=3)
The prev/next links generated by the API then also use that limit value.
That way, you should be able to test pagination on smaller datasets as well.

Is it possible to use all Magento 2's functionality through its REST API?

The last time I worked with Magento 1.x there wasn't a good REST API in place.
Now there looks to be one: http://devdocs.magento.com/swagger/index.html
I would like to integrate the Magento checkout and catalog (from a consumer perspective if you will) completely through the REST API (including the cart, stores etcetera).
Is this possible?
Magento 2 came up with vast features of REST API.So many Default REST API's are provided to manage the all customer activities,customer address management,CMS management
To know more core API
MAGENTO(ROOT FOLDER)/vendor/magento/magento-customer/etc/webapi.xml
Even we can create our own custom REST API to manage any other core activity by loading the model(db table)

REST Hateoas, managing CRUD on a ressource

Context
I m actually developping a simple application in which I need to use REST level 3 HATEOAS.
I m having two entities :
User
Billing
I need, when I add a billing, to reference the user inside of it.
Questions
What are the informations I should send to my backend, from my frontend app, to add the hateoas reference, inside the billing ressource, concerning the user ?
I mean, inside the body of the request, should I send the url of the user ressource ? Or should I send the id of the user, and then making an url discovering to get the real user url ?

Get page visitors from google analytics API

Reading Google Analytics API docs is like diving into Mariana Trench... so hoping to get some help here.
I have a website that users will visit one page per visit (most of the time). I've placed google analytics script on each page (can view reports in my GA account) and now want to write a "reporting page" on which to display information about "per page usage":
page1: 100 visitors, countries, OSes, ...
page2: 125 visitors, countries, OSes, ...
I want to get this info from API.
Could some one please point me to the right pages of the docs, from the very beginning?
For I can't understand even why I should use 2-step OAuth authorization there (or shouldn't I?) - since I'm writing this report for my own site on which I have already placed google scripts thus authorizing everything.
Thank you.
What i am thinking is that I could have a Webapplication with your pages listed. Web application itself is authenticating and querying the result on when user try to find statistics of particular page.
You should follow
1. Register Service account and get authentication key file
2. Register email account viewed in along clientid email a screen in google analytic users as admin level user
3. Use ga-dev-tools.appspot.com/explorer for query building
4.Implemenation needs
a) First Authenticate with the key
b) Get profile id and pass it to the fetching method
c) Fetch data of the query