Batch Files Upload

IMPORTANT: Please note that you will need to work with support@productiv.com to make sure these files have all the information necessary and can be understood by Productiv.

In some special circumstances, you may need to upload a large batch of files to us. You can use this upload API to send us those files programmatically. Be sure to contact us about the format of these files, or they may not get processed properly.

Prerequisites

  • Before this API can be queried you should have already set up the application for which you will be publishing the data. Once that is done you should have a unique appId that can be used to query these APIs. Visit the Set up an Application section to see how to do so.

  • In order to query this API, you would also need to send an access_token as part of the Authorization header. To see the steps for generating an access token checkout Authorization.

  • To upload files to Productiv, you will need to follow two steps:

  • The first step is to make a GET request to Productiv, specifying the list of filenames to be uploaded. The response of this API call will return signed upload URLs for each filename specified. See Get Upload URLs Endpoint for more details.
  • The second step required to complete the upload to Productiv, is to make a PUT requests with each file to upload, using the signed URL returned for each file in the first step. You can see an example of this PUT request below

Get Upload URLs Endpoint

GET https://public-api.productiv.com/services/push/v1/customer/apps/{appId}/upload

Include the following headers and path parameters along with your requests:

Headers

Parameter Value
content-type application/json
Authorization Bearer access_token
Required Scope https://api.productiv.com/connector.write

Path Params

Parameter Description
appId appId represents the App for which the data is being sent. (See Set up an Application)

Query Params

Parameter Description Optional
filenames List of file names to upload. No
type Type of files being uploaded (i.e. "users", "contracts" or "other"). Yes

Example API call

https://public-api.productiv.com/services/push/v1/customer/apps/myAppId/upload?filenames=foo.pdf&filenames=bar.pdf

Response

If the request is successful, a JSON response will be returned. This JSON object will contain a mapping from filename to the upload URL. You may make a PUT request to the upload URL to upload the file.

Example Response Schema

{
    "<filename1>": String,
    "<filename2>": String,
    ...
}

Example response:

{
  "test.pdf": "https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/test.pdf?AWSAccessKeyId=1234"
}

S3 Direct Upload Endpoint

curl -X PUT -d 'Hello world' https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/test.pdf?AWSAccessKeyId=1234

Response Errors

Error Code Error Message Description
400 Bad Request Returned if any invalid/unexpected query parameter/value is present in the request.
401 Unauthorized Returned if access_token used in request is invalid or expired.
403 Forbidden Returned if access_token does not have the required scope to use this API.
404 Not Found Returned if customer or application specified does not exist.
422 Unprocessable Entity Returned if the request payload is invalid
429 Too Many Requests Returned if rate limit has been exceeded
500 Internal Server Error Unknown error processing the request

Example Error Response Schema

{
  "code": "401",
  "message": "Invalid access_token",
  "success": false
}