Skip to content

Latest commit

 

History

History
87 lines (72 loc) · 1.71 KB

schema.md

File metadata and controls

87 lines (72 loc) · 1.71 KB

Schema API

Fetch Schema Names

Returns the names of all the schemas currently available in openTMI

  • URL

    /api/v0/schemas

  • Method:

    GET

  • Success Response:
    • Code: 200
      Content:
      ["ApiKey", "File", "Build", "Campaign", "Group", "Item", "Loan",
       "Resource", "Result", "Target", "Testcase", "User"]
  • Error Response:
    • Code: 401 UNAUTHORIZED
      Content:
      { "message": "No authorization token was found" }
  • Sample Call:

    curl http://localhost:3000/api/v0/schemas

  • Notes:

    ...

Fetch Schema

Returns the schema information of a specific model in openTMI.
Provided schema is is JSON Schema format( http://json-schema.org/ ).

  • URL

    /api/v0/schemas/:collection

  • Method:

    GET

  • Success Response:
    • Code: 200
      Content:
      {
        "collection": "Item",
        "schema": {
          "type": "object",
          "properties": {
            "barcode": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "name",
          ]
        },
        "properties": [
          "barcode",
          "name",
        ]
      }
  • Error Response:
    • Code: 401 UNAUTHORIZED
      Content:

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

      {"error": "No schema found with name: UndefinedScema"}
  • Sample Call:

    curl http://localhost:3000/api/v0/schemas/Item

  • Notes:

    ...