📜 ⬆️ ⬇️

New Google API for site verification

The level of training webmasters: advanced

Just over a year ago, we introduced a new API to verify ownership of websites for using Google services. To simplify the process of confirming the rights to the site, we decided to abolish the old method used in the API earlier on March 31, 2014. Other parts of the API remain unchanged: only the confirmation method changes. For more information about the process of confirming ownership rights, see the article on the site verification help center .

One of the advantages of switching to a new API for confirmation is that it uses the same client libraries as most other Google APIs, which makes it easy to integrate with other applications and tools. Getting started is easy, especially if you already have experience with other Google APIs:

  1. Download the Google API Client Library for your programming language.
  2. Read API information for site verification .
  3. Allow your users to authenticate with OAuth .
  4. Start the verification process!

If you can not wait to get down to business, proceed by the points:
  1. Download and install oacurl .
  2. Sign in with Google account authentication:
    $ java -cp oacurl-1.2.0.jar com.google.oacurl.Login \ --scope https://www.googleapis.com/auth/siteverification 
  3. Request information to confirm:
     $ echo '{ "verificationMethod": "FILE", "site": { "identifier": "http://www.example.com", "type": "SITE" } }' | \ java -cp oacurl-1.2.0.jar com.google.oacurl.Fetch \ 'https://www.googleapis.com/siteVerification/v1/token' \ --content-type JSON -X=POST 
  4. Create a file, upload it to the site and confirm ownership:
     $ echo '{ "site": { "identifier": "http://www.example.com", "type": "SITE" } }' | \ java -cp oacurl-1.2.0.jar com.google.oacurl.Fetch \ 'https://www.googleapis.com/siteVerification/v1/webResource?verificationMethod=FILE' \ --content-type JSON -X=POST 
  5. Done!

We hope that this Google API will simplify the process of verifying sites for your projects. If you have any questions, leave them on the forum for webmasters .

')

Source: https://habr.com/ru/post/208246/


All Articles