Skip to content

Instantly share code, notes, and snippets.

@shaharmor
Created August 2, 2015 12:29
Show Gist options
  • Save shaharmor/c5259ff36a4b79ebd3b0 to your computer and use it in GitHub Desktop.
Save shaharmor/c5259ff36a4b79ebd3b0 to your computer and use it in GitHub Desktop.
Plantie API

plantie-api

Authentication

  • Signup:

    Route: POST: /api/signup

    Body:

    {
      email: '[email protected]',
      password: "yourpassword'
    }

    Response:

    {
      error: false, // or true if failed
      msg: 'Signup succeeded',
      data: {
          access_token: 'YOUR_ACCESS_TOKEN'    
      }
    }
  • Login:

    Route: POST: /api/login

    Body:

    {
      email: '[email protected]',
      password: 'yourpassword'
    }

    Response:

    {
      error: false, // or true if failed
      msg: 'Login succeeded',
      data: {
          access_token: 'YOUR_ACCESS_TOKEN'
      }
    }

Device management

  • Claim

    Route: POST: /api/device/claim?access_token=YOUR_ACCESS_TOKEN

    Body:

    {
      id: 'YOUR_SPARK_DEVICE_ID'
    }

    Response:

    {
      error: false, // or true if failed
      msg: 'Device claim succeeded'
    }
  • List

    Route: GET: /api/device?access_token=YOUR_ACCESS_TOKEN

    Response:

    {
      error: false, // or true if failed
      msg: 'Devices listed',
      data: {
        devices: [{
          id: 'device1',
          metrics: {
            light: 100,
            moisture: 100,
            temperature: 30
          }
        }, {
          id: 'device2',
          metrics: {
            light: 200,
            moisture: 200,
            temperature: 25
           }
        }]
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment