Unit API

GET /unit/search

List of available units

Example request:

GET /unit/search?unit_id[]=127&unit_id[]=9&api_key=key-XXXXXXXXXXXXX HTTP/1.1
Host: api.dvidshub.net
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Accept: application/json, text/javascript
Referer: https://api.dvidshub.net

Example response:

HTTP/1.1 200 OK
Content-type: application/json; charset=utf-8
Content-length: 347
Connection: keep-alive
Date: Thu, 25 Apr 2024 04:23:43 GMT
Server: Apache
Access-control-allow-origin: *
X-cache: Miss from cloudfront
Via: 1.1 c396de17c1b5d58233088e40dd170cf4.cloudfront.net (CloudFront)
X-amz-cf-pop: IAD66-C1
Alt-svc: h3=":443"; ma=86400
X-amz-cf-id: 51Gcbfd8h4Va4RKvbV_FHxMgZpz1qGnQfBOBcI9DxuUY50VjQtEesQ==

{
    "messages":[
        "max_results was not supplied.  A maximum of 50 results per page will be returned."
    ],
    "page_info":{
        "total_results":2,
        "results_per_page":50
    },
    "results":[
        {
            "id":"9",
            "unit_name":"139th Mobile Public Affairs Detachment",
            "unit_abbrev":"139MPAD",
            "branch":"Army"
        },
        {
            "id":"127",
            "unit_name":"DVIDS Hub",
            "unit_abbrev":"DVIDSHUB",
            "branch":"Joint"
        }
    ]
}

Query Parameters:

  • api_key: Public API access key issued by DVIDS (key-xxxxxxxxxxxxx)
  • sortdir: One of asc, desc.
  • unit_id: [int] Unit id to retrieve contents for. | unit_id=127 | &unit_id[]=127&unit_id[]=43
  • branch: Branch name to retrieve contents for.
  • max_results: Maximum number of results to return.
  • unit_abbrev: | DVIDS abbreviation of unit credited with media asset.| unit_abbrev=DVIDSHUB | &unit_abbrev[]=DVIDSHUB&unit_abbrev[]=AFNA
  • unit_name | Full or partial name of unit.| unit_name=DVIDS hub | unit_name=DVIDS |
  • page: [int] What page to load. Defaults to 1.

Status Codes:

  • 200: no error
  • 400: invalid parameter(s) specified. See errors element in response for details.
  • 403: api_key not provided, invalid, or accessed from origin (protocol+domain) other than the one associated with the key provided.

Response Fields:

  • unit_id: Id for the unit
  • unit_name: name of the unit
  • unit_abbrev: Abbrevation for the unit
  • branch: Name of branch for the unit