Profit REST Service FileConnector

Profit Connector for uploading and downloading files.

Contents

Retrieve a file from Profit

You need the GUID and the original file name of the attachment. These can be retrieved with a GetConnector. Next, call the FileConnector and retrieve the file.

You can only use the FileConnector to retrieve files if the SubjectConnector has been activated in the app connector.

Retrieve GUID and file name using a GetConnector

  1. Go to: General / Output / Management / GetConnector.
  2. Click on: New.
  3. Add a GetConnector based on a data collection with dossier items.
  4. Change the data collection and add the following fields:
    •  Code (GUID of the attachment)
    • Name (Original file name of the attachment)

To retrieve a file using the connector:

  1. Call the Profit REST Services.
  2. Call:

    https://{Domain}/ProfitRestServices/fileconnector/{GUID}/{filename}

    Example:

    ../ProfitRestServices/fileconnector/F64BB8E942BBC5E94FC747904E19FE1B/Invoice3734.pdf

    The file name must be the original name that you have retrieved from Profit. So you cannot invent a name.

    If the file name of an attachment contains an underscore (_), replace it with _5f.

    For example: You replace file name Invoice_nr3734.pdf with Invoice_5fnr3734.pdf.

  3. Choose one of the following methods to save the file:
    • Base64 string
    • Original file format with the original file name (Binary)

Upload a file to Profit

You can only use the FileConnector to upload files if the correct UpdateConnector has been activated in the app connector. Use a suitable UpdateConnector, such as KnSubject.

This process consists of two steps:

  1. Upload the file. The file is assigned a GUID.
  2. Link the GUID to an existing dossier item.

Step 1: To upload a file:

  1. In the test tool, drag the file into the Drop files here box.
  2. Click on: Upload files.

    You can see the GUID below the box.

In a script, you can upload the file using the following call:

..ProfitRestServices/fileconnector/knsubject/[binary_filename]

Step 2: To link a GUID to a dossier item:

In this example you add a dossier item with an attachment. You must provide the original file name of the attachment and the GUID.

"KnSubject": {

"Element": {

"@SbId": 2,

"Fields": {

"StId": 4,

"Ds": "Invoice received from AFAS",

"SbPa": "Invoice12345.pdf",

"FileId": "7FF06DEF4743C61A7D595BAB68B6B55A"

},

"Objects": {

"KnSubjectLink": {

"Element": {

"@SbId": 2,

"Fields": {

"ToBC": true,

"BcId": "1001074"

}

}

}

}

}

}

}

Directly to

  1. Profit Rest Services (JSON)
  2. Call a connector using the Profit REST Service
  3. Add an app connector for the Profit REST Service
  4. Generate a token for the Profit REST Service
  5. Convert XML to JSON
  6. Call a GetConnector
  7. Call an UpdateConnector
  8. Call a ReportConnector
  9. Call a SubjectConnector
  10. Call a ProfitVersionConnector