Uploads API

POST: /images

Upload Image

POST: /videos

Upload Video

Post Parameters:

  • access_token: OAuth access token
  • api_key: public API access key issued by DVIDS (key-xxxxxxxxxxxxx)
  • file: (binary) Image file to be uploaded. Must contain vaild IPTC/XMP data according to our mapping guide
  • unit: (integer) Required unit id field
  • batch_id: (integer) Optional batch id parameter.
  • media_credit: (integer) Optional media credit parameter. If not passed in, we will attempt to detect it from the VIRIN
  • prettyprint: Spaces out JSON response in more readable format useful for debugging

Note: We use the EXIF date to determine when the image was taken.

Manual Parameters:

The following parameters can be used to manually overwrite the medias EXIF Data

  • headline: (string, image only) Headline of the Media
  • caption: (string, image only) Description of the media
  • title: (string, video only) Headline of the Media
  • description: (string, video only) Description of the media
  • keywords: (string) A list of keywords seperated by commas
  • instructions: (string) Instructions for the Media
  • date_created: (MM/DD/YYYY) Date the media was created
  • virin: (string) Unique virin code
  • subdiv: (string) State/Providence
  • country: (string) Country

Example Request:

  POST /images HTTP/1.1
  Host: api.dvidshub.net
  Referer: https://api.dvidshub.net
  Content-Type: multipart/form-data; boundary==_3a38a27c15bc2e263e151a0bc676a1d7

  Content-Type: text/plain
  Content-Disposition: form-data; name="api_key"

  Content-Type: text/plain
  Content-Disposition: form-data; name="unit"

  Content-Type: text/plain
  Content-Disposition: form-data; name="batch_id"

  Content-Type: text/plain
  Content-Disposition: form-data; name="media_credit"

  Content-Disposition: form-data; name="access_token"

  Content-Type: image/jpg; charset=binary
  Content-Disposition: form-data; name="file"; filename="some_image.jpg"

  ****FILE CONTENT****

Example Response:

 HTTP/1.1 201 Created
 Access-Control-Allow-Origin: *
 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
 Connection: Keep-Alive
 Content-Encoding: utf-8
 Content-Length: 1457
 Content-Type: application/json
 Date: Thu, 26 Feb 2015 20:11:27 GMT
 Expires: Thu, 19 Nov 1981 08:52:00 GMT
 Keep-Alive: timeout=5, max=100
 Pragma: no-cache
 Server: Apache/2.4.7 (Ubuntu)
 Set-Cookie: PHPSESSID=1skprkuqb8g08gfcss7msu7to4; path=/; domain=.dvidshub.net
 Vary: Host
 X-Powered-By: PHP/5.5.9-1ubuntu4.6    

    "headline":"2nd Cavalry Regiment engineers' construction training",
    "caption":"Troopers assigned to Regimental Engineer Squadron, 2nd Cavalry Regiment participate in construction training at the Grafenwoehr Training Area, located near Rose Barracks, Germany, Feb. 26, 2015. During the training, engineers dug ditches using heavy machinery and filled barriers for a vehicle control point pathway heading towards their makeshift Tactical Operation Center.",
    "keywords":"USAREUR, Hohenfels, Germany, Hohenfels Training Area, Rose Barracks, Grafenwoehr, 2d Cavalry Regiment, 2 CR, 4th Squadron, HHT, Headquarters and Headquarters Troop, Soldiers, Troopers, Dragoons, U.S. Army, Europe, JMRC, Training, NATO, GTA, Exercise",
    "instructions":"Released Sgt. William Tanner 2nd Cavalry Regiment William.a.tanner5.mil@mail.mil via DVIDS",

Status Codes:

  • 201: created
  • 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.