Developers

In addition to providing a useful web interface for our Medical Item Database, we have also developed a full RESTful API for developers to interact with our data in their own projects. This document outlines the API and its numerous endpoints. Access to the API is unmetered and it is not required to set up an API key or any other form of authentication in order to use. Making calls to the API is simple, just target the following URL within your application:

https://www.med-dept.com/api/

Notice: It is recommended to always make calls to the API using HTTPS, although regular HTTP connections are also supported.


Supported Endpoints:

/items/

Use this endpoint to perform actions on the items currently in the database. A series of verbs should be used to specify the action that is to be performed; this verb should be passed into the API as a second URL slug:

GET /items/fetch/:

Fetch a list of items that belong to a specific Item Class.

Available parameters:

Parameter name Type Default Description Permitted values
class string / int NULL The Class of items to retrieve from the database. 1, 2, 3, 4, 5, 6, 7, 8, 9, 'forms'
limit int 30 The number of items to fetch in the request (useful for pagination, can be used with page). Any integer > 0.
page int 1 The page of results to fetch in the request (useful for pagination, when used with limit). Any integer > 0.

Example: To fetch the second page of results for Class 9 Items using the following API call (note that this will return the second page of 30 items – i.e. an offset of 30 will be used):

https://www.med-dept.com/api/items/fetch/?class=9&page=2

Response:

This endpoint returns a JSON array containing the retrieved Items in the following format:

[
    {
        "number": "9101000",
        "name":   "Acid, Boric, Ointment, 1 oz"
    },
    {
        "number": "9101500",
        "name":   "Acid, Salicylic, Ointment, 1 oz"
    },
    ....
    {
        "number": "9111800",
        "name":   "Iodine, 2 cc"
    }
]

GET /items/search/:

Search the Item Database for items which match the specified query.

Available parameters:

Parameter name Type Default Description Permitted values
q string / int NULL The query to be used in searching the items. Both Item Name and Number will be searched. Any non-empty string or int.
limit int 30 The number of items to fetch in the request (useful for pagination, can be used with page). Any integer > 0.
page int 1 The page of results to fetch in the request (useful for pagination, when used with limit). Any integer > 0.

Example: To search all items in the Database for iodine and return 50 results per page:

https://www.med-dept.com/api/items/search/?q=iodine&limit=50

Response:

This endpoint returns a JSON array containing the retrieved Items in the following format:

[
    {
        "number":          "1235000",
        "name":            "Iodine, 1\/4 lb",
        "nameHighlighted": "<mark>Iodine<\/mark>, 1\/4 lb"
    },
    {
        "number":          "9111000",
        "name":            "Iodine and Potassium Iodide Powder, 10 Tubes",
        "nameHighlighted": "<mark>Iodine<\/mark> and Potassium Iodide Powder, 10 Tubes"
    },
    ...
    {
        "number": "9112200",
        "name": "Iodine Swab, 10-minim, 10",
        "nameHighlighted": "<mark>Iodine<\/mark> Swab, 10-minim, 10"
    }
]

Notice: The HTML5 <mark> tag is used within the nameHighlighted property to show the matched query string in the Item’s name.


GET /items/lookup/:

Lookup one (or more) Item Numbers and retrieve the fully-qualified Item from the database.

Available parameters:

Parameter name Type Default Description Permitted values
number string NULL The Item Number (or Form Name) to lookup. Multiple numbers can be specified, if separated by commas. Any non-empty string.

Example: To lookup Item #s: 1235000, 9111000 and 9112200:

https://www.med-dept.com/api/items/lookup/?number=12350,9111000,Form%2052b

Response:

This endpoint returns a JSON array containing the retrieved Items in the following format:

[
    {
        "number": "1235000",
        "name":   "Iodine, 1\/4 lb",
        "class":  "Class 1"
    },
    {
        "number": "9111000",
        "name":   "Iodine and Potassium Iodide Powder, 10 Tubes",
        "class":  "Class 9"
    },
    {
        "number": "Form 52b",
        "name":   "Emergency Medical Tag (20 in Booklet in Duplicate)",
        "class":  "Blank Forms"
    }
]

Note: This Endpoint will attempt to sanitize Item Numbers when specified. In the given example above, we have passed a 5-digit and 7-digit Item Number, as well as a Form name. As can be seen, the API will correctly deal with this request.

This page was printed from the WW2 US Medical Research Centre on 19th March 2024 at 04:28.
Read more: https://www.med-dept.com/developers/