Call a GetConnector using an app connector

An external application calls a GetConnector on the basis of a token. A GetConnector retrieves data from a Profit environment.

Note:

To improve the performance, you should limit the number of records the GetConnector retrieves.

  • Apply a filter in the properties of the GetConnector and/or the call of the GetConnector.
  • Retrieve the records in packages of, for example, 100 records per package.

For calling a GetConnector, the following two methods are available:

  • GetData

    Simple call with a filter and dividing the records into packages.

  • GetDataWithOptions

    Similar to the 'GetData' method, but with extra options for sorting and the file format of the retrieved records.

You can find all endpoints on this page.

Contents

Test the call using the web services (local installation)

You can use the procedure below to test the call using the Profit Web services.

To call a GetConnector using Web services:

  1. Start Internet Explorer.
  2. Use a URL from the table.
  3. Click on: 'GetData'.
  4. Enter the user token of the user.

    Enter the entire token, including the tags, as in the example below:

    <token><version>1</version><data>7748B1A4B5AF4A899588017DD71E55CBB60F8C504E2C16A17D1F9D9F42914C7C</data></token>

  5. Enter the name of the connector in 'connectorId'.
  6. Enter the XML code of the filter.
  7. Complete the 'skip' and 'take' fields to split the records to be retrieved into packages of, for example, 10 records.

    A GetConnector can retrieve a large number of records, despite of the use of filters. That is why we recommend to retrieve records in packages using the 'skip' and 'take' fields.

    • skip: the number of records to be skipped.
    • take: the number of records to be retrieved.

    For each packet to be retrieved, you must make a separate call. Do this until you receive a packet that does not contain any more records.

    Example: you want to retrieve data in packets of 10 records.

    Call 1: skip = 0, take = 10. Retrieve records 1 to 10.

    Example code:

    <Options>

    <Skip>0</Skip>

    <Take>10</Take>

    </Options>

    Call 2: skip = 10, take = 10. Retrieve records 11 to 20.

    Call 3: skip = 20, take = 10. Retrieve records 21 to 30.

    Etc.

    App_Cnr App connector GetConnector aanroepen

    Note:

    The use of 'skip' and 'take' is mandatory. Enter the value -1 in 'skip' as well as in 'take' if you want to retrieve all records in one go. This does carry some risk as the number of records can become very large.

  8. Click on: 'Invoke'.

    This runs the GetConnector and retrieves these records from the Profit environment.

Call in AFAS Online using Profit Web services (GetData)

Use a SOAP call to test a GetConnector.

Extra options with GetDataWithOptions

This method provides the following additional options:

  • The result is returned as XML or text.
  • Metadata can be returned.
  • Format of the data that is returned.
  • Divide records to be retrieved in packages, to improve the performance.
  • Sorting the records.

Basically, this works the same way as the 'GetData' method described above. However, in the 'GetDataWithOptions' field, you can enter an XML string with the options listed below.

Examples:

  • Output in XML, no metadata

    <Options><Outputmode>1</Outputmode><Metadata>0</Metadata></Options>

  • Output in XML, with metadata

    <Options><Outputmode>1</Outputmode><Metadata>1</Metadata></Options>

  • Output in CSV format

    <Options><Outputmode>2</Outputmode></Options>

  • Output in XML, no metadata, divide records into packages, sort records

    <Options><Outputmode>1</Outputmode><Metadata>0</Metadata><Skip>0</Skip><Take>5</Take><Index><Field FieldId="saldo" OperatorType="0"/></Index></Options>

    Note: 

    You can supply the 'skip / take' fields in two ways:

    1. As separate fields (please refer to the 'GetData' method).

    2. As part of the <Options> string described here.

    The 'skip / take' fields in the <Options> string overrule the separate fields. For example, if you use Take 2 in the 'Take' field and Take 5 in the <Options> string, Take 5 will be applied.

options (miscellaneous settings)

  • Outputmode: 1=xml, 2=text
  • Metadata: 0=False, 1=True.
  • Outputoptions: The options depend on whether you choose XML or Text. The field name 'Outputoptions' is case-sensitive.

    Output mode

    Output options

    xml (1)

    • 2 = Microsoft DataSet
    • 3 = Microsoft DataSet. Empty elements (elements without a value) are also included in the XML.

    text (2)

    • 1 = Semicolon (dates and numbers in the format of the regional settings)
    • 2 = Tab (dates and numbers in the format of the regional settings)
    • 3 = Semicolon (dd-mm-yy for dates and full stop as decimal separator for numbers)
    • 4 = Tab (dd-mm-yy for dates and full stop as decimal separator for numbers)

index (sorting)

You sort records by a field of your choosing (sorting is not mandatory). If you use this option, the use of the 'skip / take' fields is mandatory. Sorting the records only works if you call the connector from the Web services. For example, if you are using the command line, the records cannot be sorted.

Include the field you want to sort by and use the 'OperatorType' parameter to specify how you want to sort.

  • OperatorType 0 = Sort descending (from high to low)
  • OperatorType 1 = Sort ascending (from low to high)

In the below example you retrieve the first 10 records and sort them in descending order by the 'DebtorId' field.

<Options>

<Skip>0</Skip>

<Take>10</Take>

<Index>

<Field FieldId="DebtorId" OperatorType="0"/>

</Index>

</Options>

SOAP call (GetData)

Download an XML example file

  • token

    Token of the user who executes the connector. Use a CDATA tag for the token; see the XML example to be downloaded.

Specific to this connector:

  • ConnectorId: Name of the GetConnector.
  • filtersXml: Filter in the form of XML code.

SOAP call (GetDataWithOptions)

Download an XML example file

  • token

    Token of the user who executes the connector. Use a CDATA tag for the token; see the XML example to be downloaded.

  • ConnectorId: Name of the GetConnector.
  • filtersXml: Filter in the form of XML code.

Specific to this connector:

  • options
  • Skip / Take
  • Index

Directly to

  1. Call your own app connector
  2. Call a GetConnector
  3. Call an UpdateConnector
  4. Call a ReportConnector
  5. Call a SubjectConnector
  6. Call a VersionInfoConnector