Allows you to add pictures to an item that is already listed.
Header | Data Type | Valid Values | Required | Description |
---|---|---|---|---|
Content-Type | string | application/json | YES | The format your data will be sent to our site. |
X-DevKey | string | string | YES | The devkey assigned to the developer. |
X-AccessToken | string | string | YES | The token acquired from a POST to Users/AccessToken. |
NOTE: Variables to place in the body of the request.
This API call is different than most of the other API calls in our system. Most requests in our API
are sinlge part requests where the Content-Type
header describes the single type of content
in the body of the request (ie. text/json
). This request however is a multipart request which
allows you to upload physical pictures of the item as well as provide URLs to hosted pictures of the item
at the same time in the same HTTP requst. The Content-Type
header of this request must be set
to multipart/form-data
.
The first part of this request can contain JSON data listing out the URLs to the hosted pictures. The remaining
parts can consist of physical image files that will be uploaded. For the single PictureURL part, the
Content-Disposition
must be set to form-data; name="data"
. The number of URLs that can
be processed in one call is limited to 8. For the physical file parts, each part must have a Content-Disposition
of form-data; name="picture"; filename="yourfilename.jpg"
. The number of physical files that can processed in one
call is limited to 8.
The types of files that can be uploaded are restricted to .gif and .jpg. Any other file types that are attempted will simply be ignored.
An example request from Fiddler:
POST https://api.gunbroker.com/v1/pictures/xxxxxxxxx HTTP/1.1
Host: api.gunbroker.com
Connection: keep-alive
Content-Length: 38846
X-DevKey: XXX
X-AccessToken: XXX
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryuVb2LBYgc5Dy1dRn
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36
Postman-Token: b021d182-c250-9803-58bf-85e4f862aaf1
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
------WebKitFormBoundaryuVb2LBYgc5Dy1dRn
Content-Disposition: form-data; name="data"
{PictureURLs : ["https://i.imgur.com/zxVrphv.jpg", "https://i.imgur.com/KmGJT6u.jpg", "https://i.imgur.com/dJepJck.jpg"]}
------WebKitFormBoundaryuVb2LBYgc5Dy1dRn
Content-Disposition: form-data; name="picture"; filename="Gun-6573.jpg"
Content-Type: image/jpeg
[picture data here]
------WebKitFormBoundaryuVb2LBYgc5Dy1dRn--
A CURL command line example (must be on one line):
curl
-H "Content-Type: multipart/form-data"
-H "X-DevKey: XXX"
-H "X-AccessToken: XXX"
-F "data=@C:\temp\PicPost.json; type=application/json"
-F "picture=@C:\temp\gunpic1.jpg;filename=gunpic1.jpg"
-F "picture=@C:\temp\gunpic2.jpg;filename=gunpic2.jpg"
-X POST https://api.gunbroker.com/v1/pictures/xxxxxxxxx -i -v
Parameter | Data Type | Valid Values | Description |
---|---|---|---|
PictureURLs | string | Array of picture URLs | Optional. All picture URLs must be secure. For example: PictureURLs:["https://host/1.jpg","https://host/2.jpg"] |
If there is an error, you will receive a 403 Forbidden
and a Message Response indicating the reason.
If there are no errors with the input parameters, this call will respond with a 200 OK
and a message that the picture upload processed for item.