02/10
2017
REST plugin for Craft CMS
Perform authenticated REST requests, (*1)
rest
plugin folder to craft/plugins
Settings > Plugins
rest
plugin folder by the new one under craft/plugins
{% set response = craft.rest.request.url('http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=2de143494c0b295cca9337e1e96b00e0').send() %} <pre>{{ dump(response) }}</pre>
{% set response = craft.rest.request .url('http://api.openweathermap.org/data/2.5/weather') .query({ q: 'London,uk', appid: '2de143494c0b295cca9337e1e96b00e0', }) .send() %}
{% set response = craft.rest.request .authentication('youtube') .url('https://www.googleapis.com/youtube/v3/search') .query({ part: 'snippet', q: 'timelapse', }) .send() %}
{% set response = craft.oauth.getTokenById(123) %} {% set response = craft.rest.request .token(token) .url('https://www.googleapis.com/youtube/v3/search') .query({ part: 'snippet', q: 'timelapse', }) .send() %}
You can set up authentication with any OAuth provider provided by the OAuth plugin:, (*2)
The plugin also supports any third party OAuth providers supported by the OAuth plugin., (*3)
Dukt.net © 2017 - All rights reserved, (*4)