Working with Files in the Infoplus API

Working with Files in the Infoplus API

Just like when using the desktop version of Infoplus, files can be viewed and attached to any record in the system using the Infoplus API.


To use any of the file-related API calls, you must use a version of the API greater than 2.0 (this includes beta)

Attaching a File to a Record

The first way to attach a file to a record is to POST the contents of the file to Infoplus:

  1. Create a POST request to the file endpoint of the record to which you want to attach a file.
  2. The name of the file is appended to the POST URL.  
  3. Add the file's data to the request body.
  4. Add the required Content-Type header to the request, setting its value to the MIME media type of the file being uploaded.
  5. Send the request.

Here's an example of a file upload request using the image/jpeg Content-Type and the data from a JPEG file name testFile.jpg:

If successful, a 200 OK status code is returned along with the information about the file:

Attaching a File to a Record by URL

Rather than providing the contents of the file as the body of a POST, you can alternatively attach a file to a record by posting a JSON body, which contains a URL pointing at the file that you want to attach:

  1. Create a POST request to the file endpoint of the record to which you want to attach a file.
  2. The body of the post must be a JSON object, with the following properties:
    1. url (Required) - The URL of the file to be attached to the record
    2. fileName (Optional) - The name with extension you would like used for the file. If a name is not past the current name of the file in the URL will be used.
  3. Send the request.

Here's an example of a file by URL request: 

Get all Files for a Record

You can list the files attached to a record, with a GET call

  1. Create a GET request to the file endpoint of the record to which you want all files for.
  2. Send the request.

Here's an example, to list the files attached to the warehouse Aisle with id=1:

The response of this GET call is a list of file objects, with the same structure as shown above.

Notes

File Size Limits

  • File uploads are limited to a maximum of 20MB in size. 

Attaching Files to Orders

  • When attaching files to orders, be sure to include the order's suffix, which will be .000 in most cases.  For example: