dukt/rest

There is no license information available for the latest version (1.1.1) of this package.

REST plugin for Craft CMS

Maintainers

Details

github.com/dukt/rest

Source

Issues

Installs: 13

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 1

Open Issues: 0

Type:craft-plugin

1.1.1 2017-10-02 15:12 UTC

This package is auto-updated.

Last update: 2022-05-29 01:02:45 UTC


README

Perform authenticated REST requests

Table of Contents

Installing and updating

Requirements

  • Craft 2.5
  • Craft OAuth 1.0

Installation

  1. Download the latest release of the plugin
  2. Drop the rest plugin folder to craft/plugins
  3. Install REST plugin from the control panel in Settings > Plugins

Updating

  1. Download the latest release of the plugin
  2. Replace the rest plugin folder by the new one under craft/plugins
  3. Access your Craft control panel. You might be prompted to "Finish Up" the update if one or more migrations need to be applied.

Requests

Simple Request

{% set response = craft.rest.request.url('http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=2de143494c0b295cca9337e1e96b00e0').send() %}

<pre>{{ dump(response) }}</pre>

Query Parameters

{% set response = craft.rest.request
    .url('http://api.openweathermap.org/data/2.5/weather')
    .query({
        q: 'London,uk',
        appid: '2de143494c0b295cca9337e1e96b00e0',
    })
    .send() %}

Authentication

{% set response = craft.rest.request
    .authentication('youtube')
    .url('https://www.googleapis.com/youtube/v3/search')
    .query({
        part: 'snippet',
        q: 'timelapse',
    })
    .send() %}

Token

{% 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() %}

Authentications

Supported Providers

You can set up authentication with any OAuth provider provided by the OAuth plugin:

  • Facebook
  • GitHub
  • Google
  • Slack
  • Twitter
  • Vimeo

The plugin also supports any third party OAuth providers supported by the OAuth plugin.

Dukt.net © 2017 - All rights reserved