Skip to content

Instantly share code, notes, and snippets.

@adewale
Created May 21, 2016 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adewale/125f0cb2cb46b6af916a2178064efcc8 to your computer and use it in GitHub Desktop.
Save adewale/125f0cb2cb46b6af916a2178064efcc8 to your computer and use it in GitHub Desktop.
How to use the Google AMP URL API
curl -X POST -H "Content-Type: application/json" -H "X-Goog-Api-Key: FAKE_API_KEY" -d "{urls: ['http://www.theguardian.com/artanddesign/2010/oct/26/eames-furniture-team-charles-ray', 'http://www.theguardian.com/artanddesign/2015/aug/09/millennium-mills-docklands-london-developers-catch-up-last-relic', 'http://www.buzzfeed.com/alexfinnis/places-in-london-every-instagram-lover-needs-to-visit', 'http://www.buzzfeed.com/christinalan/come-eat-dessert-with-me-forever-and-ever', 'http://www.theverge.com/2015/7/20/9002721/the-mobile-web-sucks', 'http://www.theverge.com/2016/5/20/11720352/netflix-gilmore-girls-new-episodes-title-poster', 'http://www.bbc.co.uk/news/election-us-2016-35694116', 'http://www.bbc.com/news/business-36301378']}" "https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet"
{
"ampUrls": [
{
"originalUrl": "http://www.bbc.com/news/business-36301378",
"ampUrl": "http://www.bbc.co.uk/news/amp/36301378",
"cdnAmpUrl": "https://cdn.ampproject.org/c/www.bbc.co.uk/news/amp/36301378"
},
{
"originalUrl": "http://www.theverge.com/2016/5/20/11720352/netflix-gilmore-girls-new-episodes-title-poster",
"ampUrl": "http://www.theverge.com/platform/amp/2016/5/20/11720352/netflix-gilmore-girls-new-episodes-title-poster",
"cdnAmpUrl": "https://cdn.ampproject.org/c/www.theverge.com/platform/amp/2016/5/20/11720352/netflix-gilmore-girls-new-episodes-title-poster"
},
{
"originalUrl": "http://www.theverge.com/2015/7/20/9002721/the-mobile-web-sucks",
"ampUrl": "http://www.theverge.com/platform/amp/2015/7/20/9002721/the-mobile-web-sucks",
"cdnAmpUrl": "https://cdn.ampproject.org/c/www.theverge.com/platform/amp/2015/7/20/9002721/the-mobile-web-sucks"
},
{
"originalUrl": "http://www.theguardian.com/artanddesign/2015/aug/09/millennium-mills-docklands-london-developers-catch-up-last-relic",
"ampUrl": "https://amp.theguardian.com/artanddesign/2015/aug/09/millennium-mills-docklands-london-developers-catch-up-last-relic",
"cdnAmpUrl": "https://cdn.ampproject.org/c/s/amp.theguardian.com/artanddesign/2015/aug/09/millennium-mills-docklands-london-developers-catch-up-last-relic"
}
],
"urlErrors": [
{
"errorCode": "NO_AMP_URL",
"errorMessage": "AMP URL not found.",
"originalUrl": "http://www.buzzfeed.com/christinalan/come-eat-dessert-with-me-forever-and-ever"
},
{
"errorCode": "NO_AMP_URL",
"errorMessage": "AMP URL not found.",
"originalUrl": "http://www.bbc.co.uk/news/election-us-2016-35694116"
},
{
"errorCode": "NO_AMP_URL",
"errorMessage": "AMP URL not found.",
"originalUrl": "http://www.theguardian.com/artanddesign/2010/oct/26/eames-furniture-team-charles-ray"
},
{
"errorCode": "INPUT_URL_NOT_FOUND",
"errorMessage": "URL not found.",
"originalUrl": "http://www.buzzfeed.com/alexfinnis/places-in-london-every-instagram-lover-needs-to-visit"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment