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

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

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

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

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

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

  Ms4UAROvoU6Kyk7PLOmKQGQVSpjgJ4XfMuLyrnIz      
  --=_3a38a27c15bc2e263e151a0bc676a1d7
  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    

{
    "id":"366678",
    "batch_id":"694241",
    "360_fileid":"102156664",
    "setid":"498428",
    "virin":"150226-A-EM105-413",
    "folder":"1502/",
    "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.",
    "notes":"",
    "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",
    "job_identifier":null,
    "city":"Vilseck",
    "subdiv":"Bayern",
    "country":"DE",
    "date_created":"1424926800",
    "date_inserted":"1424981488",
    "date_published":"0",
    "date_modified":"2011-01-30T00:00:00-05:00",
    "unit_id":"127",
    "command_id":"0",
    "publish":"6",
    "frontpage":"0",
    "member_id":"1206857",
    "category":"Images",
    "distro":"0",
    "status_action":"0",
    "flickr_id":"0",
    "average_rating":"0.00",
    "has_jpg":"1",
    "filesize":"3030707",
    "width":"2144",
    "height":"1424",
    "core_hash":"ffff4f4d3d5d1800",
    "operation_name":"",
    "caption_writer":""
 }

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.