Skip to content

Latest commit

 

History

History
92 lines (63 loc) · 1.55 KB

resources.md

File metadata and controls

92 lines (63 loc) · 1.55 KB

Resources API

NOTE Following API's require authentication token to work.

Find Resources

Find Resources. Data schema available here

  • URL

    /api/v0/resources

  • Method

    GET

  • Success Response:

    Code: 200

    Content:

    [{
        "_id" : "5a89c4121a6d6e068a08c60e",
        "cre" : {
            "date" : "2018-02-18T18:21:06.865Z"
        },
        ...
    }]
  • Error Response:

    • Code: 401 UNAUTHORIZED

      Content:

      { "message": "No authorization token was found" }
  • Sample Call: curl -H "Authorization: Bearer mytoken123" http://localhost:3000/api/v0/resources

Notes: You can use filter results by using url parameters. E.g. /resources?hw.sn=abc`

Get single resource

Returns single Resource.

  • URL

    /api/v0/resources/:resource

    hw.sn can be also used for resource identification

  • Method:

    GET

  • Success Response:

    • Code: 200

      Content:

      {
        "_id" : "5a89c4121a6d6e068a08c60e",
        "cre" : {
          "date" : "2018-02-18T18:21:06.865Z"
        },
        ...
      }
  • Error Response:

    • Code: 401 UNAUTHORIZED Content:

      { "message": "No authorization token was found" }
    • Code: 404 NOT FOUND Content:

      {"error": "No resources found by id"}

resource events and utilization based on resource id

see documentation from here