POST /api/dropbox/readfiledetails

Reads the contents of a file, such as an API definition document (individual file or ZIP file), to the Dropbox, and returns information about the service that will be used to create the API. If the upload file is a ZIP file containing multiple services, it returns a list of services that are included in the file, so the user can specify a service.

Authorization Roles/Permissions: Must be logged in. Must be an authorized user for the resource for which the file is being uploaded.

This topic includes the following sections:

HTTP Method

POST

Back to top

URL

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

Back to top

Sample Request

The example below shows a request to upload a specific API definition document to create an API.

Request URL

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

Sample request headers

POST /api/dropbox/readfiledetails?wrapInHTML=true&document.domain= HTTP/1.1
Accept: application/vnd.soa.v81+json
X-Csrf-Token_acmepaymentscorp":"TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body #1

The request body is multipart-form data, not shown here.

Sample request #1: Curl

curl -X POST \
  http://api.acmepaymentscorp.com/api/dropbox/readfiledetails \
  -H 'Accept: application/json' \
  -H 'Cache-Control: no-cache' \
  -H 'Postman-Token: fd22a58c-9024-40d8-a108-64a6d7d1f65b' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'FileName=@C:\swagger\swagger_petstore_io_6.json'

Sample request body #2: Postman

In this example, the upload file was a ZIP file, so the response will include a list of services included in the ZIP file. Both request and response, in Postman, are shown below.

Dropbox service, readFileDetails, shown in Postman

Back to top

Request Headers

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

Header Description
Accept application/json, application/vnd.soa.v81+json
Content-Type multipart/form-data
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
FileName Form string Required The name of the file being read to the Dropbox.

Note:For information about the wrapInHTML parameter shown in the sample request above, see File Upload with Ajax. This is only used if you are running the API in a browser context.

Back to top

Response

If successful, this operation returns HTTP status code 200, with the Dropbox ID of the uploaded content.

Back to top

Sample Response

The sample response below shows successful completion of this operation.

Sample response headers: application/vnd.soa.v81+json

HTTP/1.1 200 OK
Date: Wed, 10 Feb 2016 21:54:27 GMT
Content-Type: application/vnd.soa.v81+json

Sample response body #1: application/vnd.soa.v81+json

In the example below, a single file was uploaded to the Dropbox.

{
  "FileName" : "swagger_getPetById.json",
  "FileType" : "json",
  "DropboxFileId" : 1008
}

Sample request body #2: ZIP file upload

In the example below, a ZIP file containing multiple services was uploaded to the Dropbox. In this example, the user must pick the name of the specific service to be used, when putting together the request body for the POST /api/apis operation.

{
  "FileName":"swagger_petstore_multi.zip",
  "FileType":"zip",
  "DropboxFileId":1011,
  "ZipFileEntry":[
    "swagger_petstore2.json",
    "swagger_petstore.json"
  ]
}

Back to top

Response Headers

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

Header Description
Content-Type application/json, application/vnd.soa.v81+json

Back to top

Response Body

Name Type Description
DropboxFileDetails DropboxFileDetails Contains information about file contents that were loaded into the Dropbox.

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. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
405

Method Not Allowed. For example, you might get this if you specified an invalid Accept header or omitted a required Content-Type header, or used the wrong HTTP verb.

You would also get it if the URL was incorrect, including case.

500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics