Skip to content

Instantly share code, notes, and snippets.

@RickCarlino
Last active May 11, 2017 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickCarlino/7bcfe61bf66f54592e19927f96ac3adc to your computer and use it in GitHub Desktop.
Save RickCarlino/7bcfe61bf66f54592e19927f96ac3adc to your computer and use it in GitHub Desktop.
API Docs, 10 MAY 2017

POST /api/device

Request

{
  "name": "billowing-shape-720"
}

Response

{
  "id": 3,
  "name": "billowing-shape-720",
  "webcam_url": null
}

DELETE /api/device

Response

Empty Response

GET /api/device

Response

{
  "id": 6,
  "name": "incised-sky-909",
  "webcam_url": "https://pigment.github.io/fake-logos/logos/medium/color/9.png"
}

GET /api/device

Response

{
  "id": 8,
  "name": "lunate-sunset-803",
  "webcam_url": "https://pigment.github.io/fake-logos/logos/medium/color/6.png"
}

PUT /api/device/9

Request

{
  "name": "Ruth Donnelly"
}

Response

{
  "id": 9,
  "name": "Ruth Donnelly",
  "webcam_url": "https://pigment.github.io/fake-logos/logos/medium/color/8.png"
}

POST /api/farm_events

**Notes: ** This is how you could create a FarmEvent that fires every4 minutes

Request

{
  "end_time": "2099-02-17T18:19:20.000Z",
  "executable_id": "1",
  "executable_type": "Sequence",
  "repeat": "4",
  "start_time": "2015-02-17T15:16:17.000Z",
  "time_unit": "minutely"
}

Response

{
  "id": 1,
  "start_time": "2015-02-17T15:16:17.000Z",
  "end_time": "2099-02-17T18:19:20.000Z",
  "repeat": 4,
  "time_unit": "minutely",
  "executable_id": 1,
  "executable_type": "Sequence",
  "calendar": [

  ]
}

GET /api/farm_events

Response

[
  {
    "id": 5,
    "start_time": "2017-05-08T00:00:00.000Z",
    "end_time": "2017-05-12T00:01:00.000Z",
    "repeat": 1,
    "time_unit": "monthly",
    "executable_id": 5,
    "executable_type": "Sequence",
    "calendar": [

    ]
  },
  {
    "id": 4,
    "start_time": "2017-05-07T00:00:00.000Z",
    "end_time": "2017-05-14T00:01:00.000Z",
    "repeat": 2,
    "time_unit": "weekly",
    "executable_id": 4,
    "executable_type": "Sequence",
    "calendar": [

    ]
  }
]

GET /api/farm_events

Response

[

]

DELETE /api/farm_events/2

Response

Empty Response

PATCH /api/farm_events/8

Request

{
  "farm_event": {
    "repeat": "66"
  }
}

Response

{
  "id": 8,
  "start_time": "2017-05-05T00:00:00.000Z",
  "end_time": "2017-05-12T00:01:00.000Z",
  "repeat": 3,
  "time_unit": "never",
  "executable_id": 8,
  "executable_type": "Sequence",
  "calendar": [

  ]
}

GET /api/images

Response

[
  {
    "id": 15,
    "device_id": 27,
    "attachment_processed_at": null,
    "updated_at": "2017-05-11T19:48:22.433Z",
    "created_at": "2017-05-11T19:48:22.433Z",
    "attachment_url": "https://farmbot-team.storage.googleapis.com/images/attachments/000/000/015/x640/fixture.jpg?1494532102",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3
    }
  },
  {
    "id": 14,
    "device_id": 27,
    "attachment_processed_at": null,
    "updated_at": "2017-05-11T19:48:20.881Z",
    "created_a

POST /api/images

Response

{
  "id": 17,
  "device_id": 29,
  "attachment_processed_at": null,
  "updated_at": "2017-05-11T19:48:30.387Z",
  "created_at": "2017-05-11T19:48:30.387Z",
  "attachment_url": "http://placehold.it/640%3Ftext=Processing...",
  "meta": {
    "x": 1,
    "y": 2,
    "z": 3
  }
}

GET /api/images/16

Response

{
  "id": 16,
  "device_id": 28,
  "attachment_processed_at": null,
  "updated_at": "2017-05-11T19:48:28.415Z",
  "created_at": "2017-05-11T19:48:28.415Z",
  "attachment_url": "https://farmbot-team.storage.googleapis.com/images/attachments/000/000/016/x640/fixture.jpg?1494532108",
  "meta": {
    "x": 1,
    "y": 2,
    "z": 3
  }
}

DELETE /api/images/18

Response

Empty Response

GET /api/logs

Response

[
  {
    "id": 1,
    "created_at": 1494532054,
    "message": "morph e-business channels",
    "meta": {
      "type": [
        "fun"
      ]
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 2,
    "created_at": 1494531994,
    "message": "optimize synergistic portals",
    "meta": {
      "type": [
        "error"
      ]
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 3,
    "created_at": 1494531934,
    "message": "aggregate cutting-edge platforms",
    "meta

POST /api/logs

Response

{
  "id": 11,
  "created_at": 1494532114,
  "message": "Hello, world!",
  "meta": {
    "x": 1,
    "y": 2,
    "z": 3,
    "type": "info"
  },
  "channels": [
    "toast"
  ]
}

POST /api/logs

Response

[
  {
    "id": 22,
    "created_at": 1494532114,
    "message": "one",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 23,
    "created_at": 1494532114,
    "message": "two",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 24,
    "created_at": 1494532114,
    "message": "three",
    "meta": {
      "x": 1,
    

POST /api/logs

Response

[
  {
    "id": 30,
    "created_at": 1494532115,
    "message": "one",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 31,
    "created_at": 1494532115,
    "message": "three",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [

    ]
  }
]

POST /api/logs

Response

[
  {
    "id": 37,
    "created_at": 1494532115,
    "message": "one",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 38,
    "created_at": 1494532115,
    "message": "one",
    "meta": {
      "x": 1,
      "y": 2,
      "z": 3,
      "type": "info"
    },
    "channels": [
      "toast"
    ]
  },
  {
    "id": 39,
    "created_at": 1494532115,
    "message": "one",
    "meta": {
      "x": 1,
      

DELETE /api/logs/all

Response

Empty Response

POST /api/password_resets

Request

{
  "email": "ivy@wittinggrady.io"
}

Response

{
  "status": "Check your email!"
}

PUT /api/password_resets/eyJ0eXAiOiJKV1QiLCJhbGci

Request

{
  "password": "xpassword123",
  "password_confirmation": "xpassword123"
}

Response

{
  "token": {
    "unencoded": {
      "sub": "sheldon@corkerycorwin.io",
      "iat": 1494532116,
      "jti": "12d2b392-22f1-4a34-94be-bd2ab6b71996",
      "iss": "//localhost:3000",
      "exp": 1497988116,
      "mqtt": "blooper.io",
      "os_update_server": "http://blah.com",
      "fw_update_server": "http://test.com",
      "bot": "device_39"
    },
    "encoded": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJzaGVsZG9uQGNvcmtlcnljb3J3aW4uaW8iLCJpYXQiOjE0OTQ1MzIxMTYsImp0aSI6IjEyZDJiMz

POST /api/peripherals

Request

{
  "label": "LED",
  "mode": "0",
  "pin": "13"
}

Response

{
  "id": 1,
  "pin": 13,
  "mode": 0,
  "label": "LED"
}

GET /api/peripherals

Response

[
  {
    "id": 5,
    "pin": 12,
    "mode": 1,
    "label": "MyString"
  },
  {
    "id": 4,
    "pin": 49,
    "mode": 1,
    "label": "MyString"
  }
]

DELETE /api/peripherals/2

Response

Empty Response

POST /api/points

Response

{
  "id": 1,
  "created_at": "2017-05-11T19:48:36.866Z",
  "updated_at": "2017-05-11T19:48:36.866Z",
  "device_id": 45,
  "meta": {
  },
  "name": "Fooo",
  "pointer_type": "ToolSlot",
  "radius": 50.0,
  "x": 4.0,
  "y": 5.0,
  "z": 6.0,
  "tool_id": null
}

POST /api/points

Response

{
  "id": 2,
  "created_at": "2017-05-11T19:48:36.941Z",
  "updated_at": "2017-05-11T19:48:36.941Z",
  "device_id": 46,
  "meta": {
  },
  "name": "My Lettuce",
  "pointer_type": "Plant",
  "radius": 50.0,
  "x": 23.0,
  "y": 45.0,
  "z": 0.0,
  "openfarm_slug": "limestone-lettuce"
}

POST /api/points

Response

{
  "id": 3,
  "created_at": "2017-05-11T19:48:36.998Z",
  "updated_at": "2017-05-11T19:48:36.998Z",
  "device_id": 47,
  "meta": {
    "foo": "BAR"
  },
  "name": "untitled",
  "pointer_type": "GenericPointer",
  "radius": 3.0,
  "x": 1.0,
  "y": 2.0,
  "z": 3.0
}

GET /api/points

Response

[
  {
    "id": 19,
    "created_at": "2017-05-11T19:48:37.739Z",
    "updated_at": "2017-05-11T19:48:37.739Z",
    "device_id": 51,
    "meta": {
    },
    "name": "untitled",
    "pointer_type": "GenericPointer",
    "radius": 1.5,
    "x": 70.0,
    "y": 528.0,
    "z": 370.0
  },
  {
    "id": 18,
    "created_at": "2017-05-11T19:48:37.728Z",
    "updated_at": "2017-05-11T19:48:37.728Z",
    "device_id": 51,
    "meta": {
    },
    "name": "untitled",
    "pointer_type": "GenericPointer",

GET /api/points

Response

[
  {
    "id": 22,
    "created_at": "2017-05-11T19:48:37.906Z",
    "updated_at": "2017-05-11T19:48:37.906Z",
    "device_id": 52,
    "meta": {
    },
    "name": "Cabbage 2",
    "pointer_type": "Plant",
    "radius": 50.0,
    "x": 2.0,
    "y": 2.0,
    "z": 2.0,
    "openfarm_slug": "cabbage"
  },
  {
    "id": 21,
    "created_at": "2017-05-11T19:48:37.895Z",
    "updated_at": "2017-05-11T19:48:37.895Z",
    "device_id": 52,
    "meta": {
    },
    "name": "Cabbage 1",
    "pointer_type

GET /api/points

Response

[
  {
    "id": 23,
    "created_at": "2017-05-11T19:48:38.006Z",
    "updated_at": "2017-05-11T19:48:38.006Z",
    "device_id": 53,
    "meta": {
    },
    "name": "My TS",
    "pointer_type": "ToolSlot",
    "radius": 50.0,
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "tool_id": null
  }
]

DELETE /api/points/11,12,13,14,15,16

Response

Empty Response

GET /api/points/26

Response

{
  "id": 26,
  "created_at": "2017-05-11T19:48:38.105Z",
  "updated_at": "2017-05-11T19:48:38.105Z",
  "device_id": 55,
  "meta": {
  },
  "name": "untitled",
  "pointer_type": "ToolSlot",
  "radius": 0.0,
  "x": 0.0,
  "y": 0.0,
  "z": 0.0,
  "tool_id": null
}

PUT /api/points/27

Response

{
  "id": 27,
  "created_at": "2017-05-11T19:48:38.139Z",
  "updated_at": "2017-05-11T19:48:38.195Z",
  "device_id": 56,
  "meta": {
    "foo": "BAR"
  },
  "name": "untitled",
  "pointer_type": "GenericPointer",
  "radius": 55.0,
  "x": 99.0,
  "y": 87.0,
  "z": 33.0
}

PUT /api/points/29

Response

{
  "id": 29,
  "created_at": "2017-05-11T19:48:38.249Z",
  "updated_at": "2017-05-11T19:48:38.270Z",
  "device_id": 57,
  "meta": {
  },
  "name": "My Lettuce",
  "pointer_type": "Plant",
  "radius": 1.0,
  "x": 23.0,
  "y": 45.0,
  "z": 0.0,
  "openfarm_slug": "limestone-lettuce"
}

DELETE /api/points/6

Response

Empty Response

DELETE /api/points/7

Response

Empty Response

POST /api/points/search

Response

[
  {
    "id": 24,
    "created_at": "2017-05-11T19:48:38.051Z",
    "updated_at": "2017-05-11T19:48:38.051Z",
    "device_id": 54,
    "meta": {
      "foo1": "1"
    },
    "name": "untitled",
    "pointer_type": "GenericPointer",
    "radius": 1.5,
    "x": 218.0,
    "y": 48.0,
    "z": 133.0
  }
]

POST /api/regimens

Request

{
  "color": "blue",
  "name": "Diglett Mankey Muk",
  "regimen_items": [
    {
      "sequence_id": "13",
      "time_offset": "123"
    }
  ]
}

Response

{
  "id": 1,
  "name": "Diglett Mankey Muk",
  "color": "blue",
  "device_id": 58,
  "regimen_items": [
    {
      "id": 1,
      "regimen_id": 1,
      "sequence_id": 13,
      "time_offset": 123
    }
  ]
}

GET /api/regimens

Response

[
  {
    "id": 3,
    "name": "545f507fc327caa8d6fbb984ce3d9ec3",
    "color": null,
    "device_id": 60,
    "regimen_items": [

    ]
  }
]

GET /api/regimens

Response

[

]

DELETE /api/regimens/2

Response

Empty Response

PUT /api/regimens/5

Request

{
  "color": "blue",
  "name": "something new",
  "regimen_items": [
    {
      "sequence_id": "14",
      "time_offset": "1555500000"
    },
    {
      "sequence_id": "14",
      "time_offset": "864300000"
    },
    {
      "sequence_id": "14",
      "time_offset": "950700000"
    }
  ]
}

Response

{
  "id": 5,
  "name": "something new",
  "color": "blue",
  "device_id": 63,
  "regimen_items": [
    {
      "id": 2,
      "regimen_id": 5,
      "sequence_id": 14,
      "time_offset": 1555500000
    },
    {
      "id": 3,
      "regimen_id": 5,
      "sequence_id": 14,
      "time_offset": 864300000
    },
    {
      "id": 4,
      "regimen_id": 5,
      "sequence_id": 14,
      "time_offset": 950700000
    }
  ]
}

POST /api/sequences

Response

{
  "id": 17,
  "name": "Scare Birds",
  "color": "gray",
  "body": [
    {
      "kind": "move_absolute",
      "args": {
        "location": {
          "kind": "coordinate",
          "args": {
            "x": 1,
            "y": 2,
            "z": 3
          }
        },
        "offset": {
          "kind": "coordinate",
          "args": {
            "x": 0,
            "y": 0,
            "z": 0
          }
        },
        "speed": 4
      }
    },
    {
      "kind": "move_absolut

POST /api/sequences

Response

{
  "id": 20,
  "name": "Scare Birds",
  "color": "gray",
  "body": [
    {
      "kind": "move_absolute",
      "args": {
        "location": {
          "kind": "coordinate",
          "args": {
            "x": 1,
            "y": 2,
            "z": 3
          }
        },
        "offset": {
          "kind": "coordinate",
          "args": {
            "x": 0,
            "y": 0,
            "z": 0
          }
        },
        "speed": 4
      }
    },
    {
      "kind": "move_absolut

POST /api/sequences

Response

{
  "id": 21,
  "name": "Scare Birds",
  "color": "gray",
  "body": [

  ],
  "args": {
    "is_outdated": false,
    "version": 4
  },
  "kind": "sequence"
}

POST /api/sequences

Response

{
  "id": 24,
  "name": "Scare Birds",
  "color": "gray",
  "body": [
    {
      "kind": "move_absolute",
      "args": {
        "location": {
          "kind": "coordinate",
          "args": {
            "x": 1,
            "y": 2,
            "z": 3
          }
        },
        "offset": {
          "kind": "coordinate",
          "args": {
            "x": 0,
            "y": 0,
            "z": 0
          }
        },
        "speed": 4
      }
    },
    {
      "kind": "move_absolut

GET /api/sequences

Response

[
  {
    "id": 32,
    "name": "Enhanced user-facing customer loyalty",
    "color": "purple",
    "body": [

    ],
    "args": {
      "version": 4,
      "is_outdated": true
    },
    "kind": "sequence"
  },
  {
    "id": 31,
    "name": "Multi-lateral even-keeled solution",
    "color": "pink",
    "body": [

    ],
    "args": {
      "version": 4,
      "is_outdated": true
    },
    "kind": "sequence"
  }
]

DELETE /api/sequences/25

Response

Empty Response

DELETE /api/sequences/27

Response

Empty Response

GET /api/sequences/33

Response

{
  "id": 33,
  "name": "Assimilated scalable methodology",
  "color": "gray",
  "body": [

  ],
  "args": {
    "version": 4,
    "is_outdated": true
  },
  "kind": "sequence"
}

PATCH /api/sequences/34

Response

{
  "id": 34,
  "name": "Scare Birds",
  "color": "orange",
  "body": [
    {
      "kind": "move_absolute",
      "args": {
        "location": {
          "kind": "coordinate",
          "args": {
            "x": 1,
            "y": 2,
            "z": 3
          }
        },
        "offset": {
          "kind": "coordinate",
          "args": {
            "x": 0,
            "y": 0,
            "z": 0
          }
        },
        "speed": 4
      }
    },
    {
      "kind": "move_absol

PATCH /api/sequences/36

Response

{
  "id": 36,
  "name": "Scare Birds",
  "color": "orange",
  "body": [

  ],
  "args": {
    "version": 4,
    "is_outdated": false
  },
  "kind": "sequence"
}

POST /api/tokens

Request

{
  "user": {
    "email": "adalberto.brown@buckridgedibbert.info",
    "password": "password"
  }
}

Response

{
  "token": {
    "unencoded": {
      "sub": "adalberto.brown@buckridgedibbert.info",
      "iat": 1494532120,
      "jti": "50895b5a-ae73-4fa4-8620-059f5c854edb",
      "iss": "//localhost:3000",
      "exp": 1497988120,
      "mqtt": "blooper.io",
      "os_update_server": "http://blah.com",
      "fw_update_server": "http://test.com",
      "bot": "device_78"
    },
    "encoded": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZGFsYmVydG8uYnJvd25AYnVja3JpZGdlZGliYmVydC5pbmZvIiwiaWF0IjoxN

POST /api/tools

Response

{
  "id": 12,
  "name": "wow",
  "status": "inactive"
}

POST /api/tools

Response

{
  "id": 13,
  "name": "wow2",
  "status": "inactive"
}

GET /api/tools

Response

[
  {
    "id": 21,
    "name": "MoltresFlareon",
    "status": "active"
  }
]

DELETE /api/tools/15

Response

{
  "id": 15,
  "name": "IvysaurJigglypuff",
  "status": "inactive"
}

GET /api/tools/23

Response

{
  "id": 23,
  "name": "SeadraWeedle",
  "status": "active"
}

PATCH /api/tools/25

Request

{
  "name": "Hi!"
}

Response

{
  "id": 25,
  "name": "Hi!",
  "status": "active"
}

DELETE /api/users

Request

{
  "password": "Bd1jYkNqJ"
}

Response

{
  "id": 75,
  "device_id": 95,
  "name": "Diego Erdman",
  "email": "willard.lehner@reilly.org",
  "created_at": "2017-05-11T19:48:41.780Z",
  "updated_at": "2017-05-11T19:48:41.780Z",
  "verified_at": "2017-05-11T19:48:41.778Z",
  "verification_token": "1e2362a3-0e83-4c81-9ed0-bca0ead78b72",
  "agreed_to_terms_at": null
}

PATCH /api/users

Request

{
  "email": "rick@rick.com",
  "name": "Ricky McRickerson"
}

Response

{
  "email": "rick@rick.com",
  "id": 76,
  "name": "Ricky McRickerson",
  "verification_token": "5f83959f-c053-4ff2-9bdd-5df32b4ae853",
  "device_id": 96,
  "created_at": "2017-05-11T19:48:41.924Z",
  "updated_at": "2017-05-11T19:48:41.938Z",
  "verified_at": "2017-05-11T19:48:41.922Z",
  "agreed_to_terms_at": null
}

PATCH /api/users

Request

{
  "new_password": "123456789",
  "new_password_confirmation": "123456789",
  "password": "RsJsS8R04"
}

Response

{
  "email": "amie_pfeffer@zemlakdubuque.com",
  "id": 77,
  "verification_token": "96c48cbe-0c71-480a-bfaa-b6ef7c3d72dc",
  "device_id": 97,
  "name": "William Parisian",
  "created_at": "2017-05-11T19:48:41.980Z",
  "updated_at": "2017-05-11T19:48:41.997Z",
  "verified_at": "2017-05-11T19:48:41.978Z",
  "agreed_to_terms_at": null
}

POST /api/users

Request

{
  "email": "michale@dubuquecrooks.com",
  "name": "Frank",
  "password": "Password123",
  "password_confirmation": "Password123"
}

Response

{
  "message": "Check your email!"
}

PUT /api/users/verify/eff290ce-f3b5-4311-a785-663

Request

{
  "token": "eff290ce-f3b5-4311-a785-66399933998f"
}

Response

{
  "token": {
    "unencoded": {
      "sub": "hazel.rosenbaum@zulaufjones.name",
      "iat": 1494532122,
      "jti": "c3c8f869-94b3-4427-b86e-4e47742991d3",
      "iss": "//localhost:3000",
      "exp": 1497988122,
      "mqtt": "blooper.io",
      "os_update_server": "http://blah.com",
      "fw_update_server": "http://test.com",
      "bot": "device_101"
    },
    "encoded": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJoYXplbC5yb3NlbmJhdW1AenVsYXVmam9uZXMubmFtZSIsImlhdCI6MTQ5NDUzMjEyM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment