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 examples of this PUT request below
Endpoint
GET | https://public-api.productiv.com/services/push/v1/customer/apps/{appId}/upload |
Required Scope | https://api.productiv.com/connector.write |
Request headers
Parameter | Value |
---|---|
content-type | application/json |
Authorization | Bearer access_token |
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:
{
"foo.pdf": "https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/foo.pdf?AWSAccessKeyId=1234",
"bar.pdf": "https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/bar.pdf?AWSAccessKeyId=1234"
}
S3 Direct Upload Endpoint
The URLs returned in the response can then be used to upload each file individually via a PUT request to the URL.
Example file uploads
curl -X PUT -d 'Contents of foo' https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/foo.pdf?AWSAccessKeyId=1234
curl -X PUT -d 'Contents of bar' https://productiv-data.s3.us-west-2.amazonaws.com/log-connector-data/productiv-ai/myAppId/contracts/bar.pdf?AWSAccessKeyId=1234