Authentication error in google shopping search API

1000 views Asked by At

I want to use Google Shopping Search API for products search. I have followed all the steps stated in document. First I created a google account, then went to GOOGLE APIs console to create a project and got an API key. I want to use this service as publishers in the Google Affiliate Network who can use the API to access product offers from their advertisers of choice. Then I signed up at google affliate network to get pid. Then I send request to some advertisers to join their program from my affiliate admin panel. Now I have one advertiser approved. Now on this document, it states that to request feed to access products from google affiliate network advertisers of publisher I have to use the following url

https://www.googleapis.com/shopping/search/v1/source/products

Where source in the url is replaced by gan:mypublisherid after putting this my url looks like

https://www.googleapis.com/shopping/search/v1/gan:myid/products?key=mykey&country=US

But When I access this url i found following json error

{
"error": {
 "errors": [
  {
"domain": "global",
"reason": "conditionNotMet",
"message": "authentication is required for GAN",
"locationType": "header",
"location": "If-Match"
}
],
"code": 412,
"message": "authentication is required for GAN"
}
}

Now my question is how to get authenticated? Is my url is correct or there is some thing other way to do this?

Best Regards.

1

There are 1 answers

0
Shadow On BEST ANSWER

Read this article. The last part i.e. authentication.

You have to get an access token before using the API. You can either use OAuth or Client Login token. To get a token using Client login you can use cURL. Remember to put servicetype as shoppingapi as the document says.