POST /api/dropbox/pictures

Adds an image for a resource such as a user profile. Provides a temporary storage location for an avatar image the user uploads as part of creating or updating a resource such as a user profile, an API, or an app.

For more information on managing images associated with resources on the portal, refer to Managing Avatars on the Portal.

Authorization Roles/Permissions: To complete this operation successfully, a user must be logged in and must be either an authorized user for the resource or a site admin.

This topic includes the following sections:

HTTP Method

POST

Back to top

URL

https://{hostname}/api/dropbox/pictures

Back to top

Sample Request

The example below shows a picture being uploaded. The image is part of the multipart/form-data request body.

Note: If you are using iframes, you can wrap the image in HTML so that it will work with the browser's same-origin security policy. For more information, see File Upload with Ajax.

Request URL

https://{hostname}/api/dropbox/pictures

Sample request headers

POST /api/dropbox/pictures HTTP/1.1
Host: {hostname}
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Content-Type: multipart/form-data; boundary=---------------------------15197250722578
X-Csrf-Token_{tenant}: {TokenID}

Sample request body

The request body is the image which the user uploaded.

Back to top

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept Any Accept header value that supports a response Content-Type of text/plain is valid; for example, */*.
Content-Type multipart/form-data

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
InMultiPart Body multipart Required The image that will be associated with the resource, and possibly additional metadata. For example, the picture might be wrapped in HTML; see File Upload with Ajax.

Back to top

Response

If successful, this operation returns HTTP status code 200, with a string confirmation that the operation is complete.

Back to top

Sample Response

The sample response below shows that the operation completed successfully.

Sample response headers

HTTP/1.1 200 OK
Content-Type: text/html
Expires: Tue, 29 Sep 2015 14:10:36 GMT

Sample response body #1: plain text

1001

Sample response body #2: with Wrap In HTML parameter

<!DOCTYPE html><html lang="en" status="200" statusText="success"><head><meta content="text/html; charset=UTF-8" 
http-equiv="Content-Type"><meta content="IE=edge" http-equiv="X-UA-Compatible"><meta name="description" 
content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris lacus elit, ornare eget luctus vel, 
porta id elit. Maecenas molestie, libero sit amet blandit faucibus, orci nisi aliquet nisi, id mollis mauris 
ipsum a enim. Morbi lacus velit, placerat sit amet luctus eget, pulvinar a massa. Lorem ipsum dolor sit amet, 
consectetur adipiscing elit. Morbi eleifend tincidunt pellentesque. Cras eu sapien massa, vitae rutrum sapien.
 Aenean id condimentum sem. Suspendisse tempor luctus ipsum, vel metus."></head>
<body status="200" statusText="success">1001</body></html>

Note: for information about the HTML wrapper shown in the sample response above, see File Upload with Ajax.

Back to top

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type text/plain

Back to top

Response Body

Name Type Description
PictureId long A temporary ID for a picture on the platform, such as the avatar for an app, API, or user. The PictureId is assigned by the Dropbox when the picture is first uploaded to the server, using the Dropbox service, as part of adding or updating the resource. PictureId is essentially the same as DropboxId.

Back to top

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics