Working with Files in the Infoplus API

Learn how to attach or receive a file(s) to an API call to or from Infoplus.

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:

 

 

Printing Order Files in Fulfillment Processes

It's not uncommon that our customers would need the ability to take files attached to orders (ie external labels, inserts, custom packing slips etc) and have those documents available within the document section of fulfillment processes. To do this, a smart document can be implemented at the fulfillment plan level to get the files attached to each order in the process and produce the file image via the smart document. A script would be applied to the smart document that uses logic to get the files from each order and return them to the smart document as an image. The caveat is that there needs to be a file for each unique document attached to the order. For example, if there are multiple external shipping labels for the order, each label would need to be attached as a file so the smart document can be properly formatted. If files cannot be attached independently, this level of automation will not be possible and the files would need to be printed manually from the order record. Our professional services team can assist any of our clients who do not have the technical resources or bandwidth to implement this on their own.