Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The API is define in using RAML in the following code:

Code Block
titleOpenHIM API - RAML
collapsetrue
#%RAML 0.8
title: OpenHIM API
version: v0.1
/users:
  get:
    description: Retrieves a list of users
    queryParameters:
      role:
        displayName: Role
        description: The role that a user must have to be retrieved
        example: PoC_Role
        type: string
        required: false
    responses:
      200:
        body:
          application/json:
            example: |
              [
                {
                  "userID": "User1",
                  "name": "User1",
                  "roles": [ "OpenMRS_PoC", "PoC" ],
                  "password": "",
                  "cert": ""
                },
                {
                  "userID": "User2",
                  "name": "User2",
                  "roles": [ "OpenMRS_PoC", "PoC" ],
                  "password": "",
                  "cert": ""
                }
              ]
      401:
        description: No users found
  post:
    description: Creates a new user
    body:
      application/json:
        example: |
          {
            "userID": "Musha_OpenMRS",
            "name": "OpenMRS Mush instance",
            "roles": [ "OpenMRS_PoC", "PoC" ],
            "password": "",
            "cert": ""
          }
    responses:
      201:
        description: The user was created sucessfully
  /{userId}:
    get:
      description: Retrieves the details for a specific user
      responses:
        200:
          body:
            application/json:
              example: |
                {
                  "userID": "Musha_OpenMRS",
                  "name": "OpenMRS Mush instance",
                  "roles": [ "OpenMRS_PoC", "PoC" ],
                  "password": "",
                  "cert": ""
                }
    put:
      description: Updates the details for a specific user
      body:
        application/json:
          example: |
            {
              "userID": "Musha_OpenMRS",
              "name": "OpenMRS Mush instance",
              "roles": [ "OpenMRS_PoC", "PoC" ],
              "password": "",
              "cert": ""
            }
      responses:
        200:
          description: The user was successfully updated
    delete:
      description: Deletes a specific users details
      responses:
        200:
          description: The user was successfully deleted
/transactions:
  get:
    description: Retrieves a list of transactions
    queryParameters:
      fromDate:
        displayName: From Date
        description: The date to filter results from in ISO8601 format
        example: "30-12-2013T00:00:00"
        type: date
        required: false
      toDate:
        displayName: To Date
        description: The date to filter results to in ISO8601 format
        example: "30-12-2013T00:00:00"
        type: date
        required: false
      status:
        displayName: Status
        description: The processing status of the transaction
        example: Completed
        type: string
        required: false
      userId:
        displayName: User ID
        description: The user ID to filter transactions by
        example: User123
        type: string
        required: false
      uriLike:
        displayName: URI Pattern
        description: A regex pattern to filter the transaction URI by
        example: "/test/sample/.+"
        type: string
        required: false
    responses:
      200:
        body:
          application/json:
            example: |
              [
                {
                  "transactionId": "123",
                  "status": "Processing|Failed|Completed",
                  "userId": "Musha_OpenMRS",
                  "request": {
                      "path": "/api/test",
                      "headers": [
                          { "header1": "value1" },
                          { "header2": "value2" }
                      ],
                      "requestParams": [
                          { "param1": "value1" },
                          { "param2": "value2" }
                      ],
                      "body": "<HTTP body>",
                      "method": "POST",
                      "timestamp": "<ISO 8601>"
                  },
                  "response": {
                      "status": 201,
                      "body": "<HTTP body>",
                      "headers": [
                          { "header1": "value1" },
                          { "header2": "value2" }
                      ],
                      "timestamp": "<ISO 8601>"
                  },
                  "routes": [
                      {
                          "name": "<route name>"
                          // Same structure as above
                          "request": { ... },
                          "response": { ... }
                      }
                  ]
                  "orchestrations": [
                      {
                          "name": "<orchestration name>"
                          // Same structure as above
                          "request": { ... },
                          "response": { ... }
                      }
                  ]
                  "properties": [ // optional meta data about a transaction
                      { "prop1": "value1" },
                      { "prop2": "value2" }
                  ]
                }
              ]
  /{transactionId}:
    get:
      description: Retrieves the details of a specific transaction
      responses:
        200:
          body:
            application/json:
              example: |
                {
                  "transactionId": "123",
                  "status": "Processing|Failed|Completed",
                  "userId": "Musha_OpenMRS",
                  "request": {
                      "path": "/api/test",
                      "headers": [
                          { "header1": "value1" },
                          { "header2": "value2" }
                      ],
                      "requestParams": [
                          { "param1": "value1" },
                          { "param2": "value2" }
                      ],
                      "body": "<HTTP body>",
                      "method": "POST",
                      "timestamp": "<ISO 8601>"
                  },
                  "response": {
                      "status": 201,
                      "body": "<HTTP body>",
                      "headers": [
                          { "header1": "value1" },
                          { "header2": "value2" }
                      ],
                      "timestamp": "<ISO 8601>"
                  },
                  "routes": [
                      {
                          "name": "<route name>"
                          // Same structure as above
                          "request": { ... },
                          "response": { ... }
                      }
                  ]
                  "orchestrations": [
                      {
                          "name": "<orchestration name>"
                          // Same structure as above
                          "request": { ... },
                          "response": { ... }
                      }
                  ]
                  "properties": [ // optional meta data about a transaction
                      { "prop1": "value1" },
                      { "prop2": "value2" }
                  ]
                }
    put:
      description: Updates the details for a specific transaction
      body:
        application/json:
          example: |
            {
              "transactionId": "123",
              "status": "Processing|Failed|Completed",
              "userId": "Musha_OpenMRS",
              "request": {
                  "path": "/api/test",
                  "headers": [
                      { "header1": "value1" },
                      { "header2": "value2" }
                  ],
                  "requestParams": [
                      { "param1": "value1" },
                      { "param2": "value2" }
                  ],
                  "body": "<HTTP body>",
                  "method": "POST",
                  "timestamp": "<ISO 8601>"
              },
              "response": {
                  "status": 201,
                  "body": "<HTTP body>",
                  "headers": [
                      { "header1": "value1" },
                      { "header2": "value2" }
                  ],
                  "timestamp": "<ISO 8601>"
              },
              "routes": [
                  {
                      "name": "<route name>"
                      // Same structure as above
                      "request": { ... },
                      "response": { ... }
                  }
              ]
              "orchestrations": [
                  {
                      "name": "<orchestration name>"
                      // Same structure as above
                      "request": { ... },
                      "response": { ... }
                  }
              ]
              "properties": [ // optional meta data about a transaction
                  { "prop1": "value1" },
                  { "prop2": "value2" }
              ]
            }
      responses:
        200:
          description: Transaction updated successfully
    delete:
      description: Deletes a specific transaction
      responses:
        200:
          description: Transaction deleted successfully
/channels:
  get:
    description: Retrieves the list of active channels
    queryParameters:
      uriLike:
        displayName: URI Pattern
        description: A regex pattern to filter the channel URI by
        example: "/test/sample/.+"
        type: string
        required: false
    responses:
      200:
        body:
          application/json:
            example: |
              [
                {
                    "name": "Some Registry Channel",
                    "urlPattern": "test/sample/.+",
                    "allow": "*",
                    "deny": [ "Mallet" ],
                    "routes": [
                        {
                            "name": "Some Registry",
                            "path": "some/other/path" // this is optional if left out original path is used
                            "host": "localhost",
                            "port": 8080 
                        }
                         
                    ]
                },
                {
                    "name": "Some Registry Channel",
                    "urlPattern": "test/sample2/.+/test2",
                    "allow": [ "Alice","Bob" ],
                    "routes": [
                        {
                            "name": "Some Registry",
                            "host": "localhost",
                            "port": 8080,
                            "primary": true
                        },
                        {
                            "name": "Logger",
                            "host": "log-host",
                            "port": 4789 
                        }
                    ]
                }
              ]          
  post:
    description: Creates a new channel
    body:
      application/json:
        example: |
          {
            "name": "Some Registry Channel",
            "urlPattern": "test/sample2/.+/test2",
            "allow": [ "Alice","Bob" ],
            "routes": [
              {
                  "name": "Some Registry",
                  "host": "localhost",
                  "port": 8080,
                  "primary": true
              },
              {
                  "name": "Logger",
                  "host": "log-host",
                  "port": 4789 
              }
            ]
          }
    responses:
      201:
        description: Channel successfully created
  /{channelName}:
    get:
      description: Retrieves the details for a specific channel
      responses:
        200:
          body:
            application/json:
              example: |
                {
                  "name": "Some Registry Channel",
                  "urlPattern": "test/sample2/.+/test2",
                  "allow": [ "Alice","Bob" ],
                  "routes": [
                    {
                        "name": "Some Registry",
                        "host": "localhost",
                        "port": 8080,
                        "primary": true
                    },
                    {
                        "name": "Logger",
                        "host": "log-host",
                        "port": 4789 
                    }
                  ]
                }
    put:
      description: Updates the details for a specific channel
      body:
        application/json:
          example: |
            {
              "name": "Some Registry Channel",
              "urlPattern": "test/sample2/.+/test2",
              "allow": [ "Alice","Bob" ],
              "routes": [
                {
                    "name": "Some Registry",
                    "host": "localhost",
                    "port": 8080,
                    "primary": true
                },
                {
                    "name": "Logger",
                    "host": "log-host",
                    "port": 4789 
                }
              ]
            }
      responses:
        200:
          description: The channel was successfully updated
    delete:
      description: Deletes a specific channels details
      responses:
        200:
          description: The channel was successfully deleted
/monitor:
  get:
    description: Retrieves overall monitoring details
    responses:
      200:
        body:
          application/json:
            example: |
              [
                TODO
              ]
  /{channelName}:
    get:
      description: Retrieves monitoring details for a particular channel
      responses:
        200:
          body:
            application/json:
              example: |
                {
                  TODO
                }
    

 . You can view the details of the API here or you can view the raw RAML code here.