amp-htmlamp-story

Are API calls possible using amp-story? Are there any examples?


Are API calls possible using amp-story? Are there any examples for <amp-story>?

Link to AMP Content

Use the AMP URL API to match URLs to corresponding AMP URLs, and serve the AMP versions instead.

Request an AMP URL via:

POST https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet

The batchGet method returns the AMP URL mapping in JSON:


Solution

  • The AMP URL API is not intended to be called at runtime, but rather server-side. amp-story imposes no restrictions to what you do server-side, so you may use this if you like.

    Client-side, the only way, currently, to make a REST call within <amp-story> is by using <amp-list>, which does not support POST requests.