### GET /profitrestservices (REST/JSON Production) Source: https://help.afas.nl/se/index_page=6 REST/JSON service endpoints for the Production environment. Use appropriate HTTP methods (GET, POST, etc.) to interact with connectors, version info, and file/image resources. ```APIDOC ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/connectors/{connectorName} ### Description Retrieves information about a specific connector. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/connectors/{connectorName} ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required - Your participant number. - **connectorName** (string) - Required - Name of the connector. #### Query Parameters - **includeDetails** (boolean) - Optional - Whether to include detailed metadata. ### Request Example GET https://12345.rest.afas.online/profitrestservices/connectors/InvoiceConnector?includeDetails=true ### Response #### Success Response (200) - **id** (string) - Connector identifier. - **name** (string) - Connector name. - **description** (string) - Description of the connector. ### Response Example { "id": "c123", "name": "InvoiceConnector", "description": "Handles invoice data." } --- ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/profitversion ### Description Returns the version of the Profit REST services. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/profitversion ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. ### Request Example GET https://12345.rest.afas.online/profitrestservices/profitversion ### Response #### Success Response (200) - **version** (string) - Current version string. ### Response Example { "version": "2024.2" } --- ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/subjectconnector/{SubjectId}/{FileId} ### Description Retrieves a specific file for a given subject. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/subjectconnector/{SubjectId}/{FileId} ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. - **SubjectId** (string) - Required - Identifier of the subject. - **FileId** (string) - Required - Identifier of the file. ### Request Example GET https://12345.rest.afas.online/profitrestservices/subjectconnector/ABC123/FILE789 ### Response #### Success Response (200) - **fileContent** (base64) - Base64-encoded file data. - **fileName** (string) - Original file name. ### Response Example { "fileName": "invoice.pdf", "fileContent": "JVBERi0xLjQK..." } --- ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/reportconnector/{ReportID} ### Description Executes and retrieves a report by its identifier. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/reportconnector/{ReportID} ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. - **ReportID** (string) - Required - Identifier of the report. ### Request Example GET https://12345.rest.afas.online/profitrestservices/reportconnector/Report123 ### Response #### Success Response (200) - **reportContent** (base64) - Base64-encoded report file. - **format** (string) - Report format (e.g., PDF, CSV). ### Response Example { "format": "PDF", "reportContent": "JVBERi0xLjQK..." } --- ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/fileconnector/{FileId}/{FileName} ### Description Downloads a file stored in the file connector. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/fileconnector/{FileId}/{FileName} ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. - **FileId** (string) - Required. - **FileName** (string) - Required. ### Request Example GET https://12345.rest.afas.online/profitrestservices/fileconnector/FILE123/document.docx ### Response #### Success Response (200) - **fileContent** (base64) - Base64-encoded file. ### Response Example { "fileContent": "UEsDBBQABgAIAAAAIQD..." } --- ## GET https://{ParticipantNumber}.rest.afas.online/profitrestservices/imageconnector/{ImageId} ### Description Retrieves an image by its identifier. ### Method GET ### Endpoint https://{ParticipantNumber}.rest.afas.online/profitrestservices/imageconnector/{ImageId} ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. - **ImageId** (string) - Required. ### Request Example GET https://12345.rest.afas.online/profitrestservices/imageconnector/IMG456 ### Response #### Success Response (200) - **imageContent** (base64) - Base64-encoded image data. - **contentType** (string) - MIME type of the image. ### Response Example { "contentType": "image/png", "imageContent": "iVBORw0KGgoAAAANSUhEUg..." } ``` -------------------------------- ### GET / (SOAP API - Production) Source: https://help.afas.nl/se/index_page=20 Connects to the AFAS PCC SOAP API for production environments to support integrations/connectors and PCC users. ```APIDOC ## GET / ### Description Verifies connectivity to the AFAS PCC SOAP API for production environments, used by connectors/links and PCC users. ### Method GET ### Endpoint https://[deelnemer].soap.afas.online/ ### Parameters #### Path Parameters - [deelnemer] (string) - Required - Your AFAS participant subdomain #### Query Parameters - None #### Request Body - None ### Request Example GET https://example.soap.afas.online/ HTTP/1.1 Host: example.soap.afas.online ### Response #### Success Response (200) - SOAP API reachable over HTTPS #### Response Example HTTP/1.1 200 OK ### Security - TLS version: 1.2 - TLS ciphers: [0xC0,0x2F], [0xC0,0x30] (ECDHE suites) - Public IP range (production): 185.46.182.140 - 185.46.182.179 - Port: 443/tcp - For TLS 1.3 (Profit incoming only), supported ciphers: TLS1.3-AES256-GCM-SHA384 (0x13,0x02), TLS1.3-CHACHA20-POLY1305-SHA256 (0x13,0x03), TLS1.3-AES128-GCM-SHA256 (0x13,0x01) ``` -------------------------------- ### GET / (REST API - Production) Source: https://help.afas.nl/se/index_page=20 Connects to the AFAS PCC REST API for production environments, used by connectors/links and PCC users. ```APIDOC ## GET / ### Description Verifies connectivity to the AFAS PCC REST API for production environments. ### Method GET ### Endpoint https://[deelnemer].rest.afas.online/ ### Parameters #### Path Parameters - [deelnemer] (string) - Required - Your AFAS participant subdomain #### Query Parameters - None #### Request Body - None ### Request Example GET https://example.rest.afas.online/ HTTP/1.1 Host: example.rest.afas.online ### Response #### Success Response (200) - REST API reachable over HTTPS #### Response Example HTTP/1.1 200 OK ### Security - TLS version: 1.2 - TLS ciphers: [0xC0,0x2F], [0xC0,0x30] - Public IP range (production): 185.46.182.140 - 185.46.182.179 - Port: 443/tcp ``` -------------------------------- ### GET /profitrestservices/profitversion Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves the version information of the AFAS Profit service. It requires no parameters. ```APIDOC ## GET /profitrestservices/profitversion ### Description Retrieves the version details of the Profit REST services. ### Method GET ### Endpoint /profitrestservices/profitversion ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **version** (string) - The version string of the service. #### Response Example { "version": "1.0.0" } ``` -------------------------------- ### GET / (SOAP API - Accept) Source: https://help.afas.nl/se/index_page=20 Connects to the AFAS PCC SOAP API for accept environments, used by connectors/links and PCC users that integrate with AFAS accept environments. ```APIDOC ## GET / ### Description Verifies connectivity to the AFAS PCC SOAP API for accept environments. ### Method GET ### Endpoint https://[deelnemer].soapaccept.afas.online/ ### Parameters #### Path Parameters - [deelnemer] (string) - Required - Your AFAS participant subdomain #### Query Parameters - None #### Request Body - None ### Request Example GET https://example.soapaccept.afas.online/ HTTP/1.1 Host: example.soapaccept.afas.online ### Response #### Success Response (200) - SOAP API reachable over HTTPS #### Response Example HTTP/1.1 200 OK ### Security - TLS version: 1.2 - TLS ciphers: [0xC0,0x2F], [0xC0,0x30] - Public IPs (accept): 185.46.182.44, 185.46.182.45, 185.46.182.46, 185.46.182.47 - Port: 443/tcp ``` -------------------------------- ### GET / (SOAP API - Test) Source: https://help.afas.nl/se/index_page=20 Connects to the AFAS PCC SOAP API for test environments, used by connectors/links and PCC users that integrate with AFAS test environments. ```APIDOC ## GET / ### Description Verifies connectivity to the AFAS PCC SOAP API for test environments. ### Method GET ### Endpoint https://[deelnemer].soaptest.afas.online/ ### Parameters #### Path Parameters - [deelnemer] (string) - Required - Your AFAS participant subdomain #### Query Parameters - None #### Request Body - None ### Request Example GET https://example.soaptest.afas.online/ HTTP/1.1 Host: example.soaptest.afas.online ### Response #### Success Response (200) - SOAP API reachable over HTTPS #### Response Example HTTP/1.1 200 OK ### Security - TLS version: 1.2 - TLS ciphers: [0xC0,0x2F], [0xC0,0x30] - Public IP range (test): 185.46.182.180 - 185.46.182.199 - Port: 443/tcp ``` -------------------------------- ### GET /Profitrestservices/metainfo Source: https://help.afas.nl/se/index_page=75 Retrieves meta-information from AFAS Profit services. Requires Base64-encoded AFAS token in Authorization header. ```APIDOC ## GET /Profitrestservices/metainfo ### Description Retrieves meta-information about available connectors and their structure from AFAS Profit services. ### Method GET ### Endpoint https://[environment].afas.nl/Profitrestservices/metainfo ### Parameters #### Header Parameters - **Authorization** (string) - Required - Value must be 'AfasToken ' followed by the Base64-encoded XML token ### Request Example ```http GET https://12345.afas.nl/Profitrestservices/metainfo Authorization: AfasToken PEtkb20+PHZlcnNpb24+MTwvdmVyc2lvbj48ZGF0YT48IVtDREFUQVswRTY4MjQ2MTIwNDNBQTlFMjU0REI5NjEyMjNERDMyRjE0OTQzRDkzMTg0RTVBMzQ1NTNDMERGQTRG=XV0+PC9kb20+ ``` ### Response #### Success Response (200) - **connectors** (array) - List of available connectors with their metadata #### Response Example ```json { "connectors": [ { "name": "Profit_Article", "description": "Article master data" } ] } ``` ``` -------------------------------- ### GET /profitrestservices/fileconnector// Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves a file by its ID and name. It requires file ID and name as path parameters. ```APIDOC ## GET /profitrestservices/fileconnector// ### Description Retrieves a specific file. ### Method GET ### Endpoint /profitrestservices/fileconnector// ### Parameters #### Path Parameters - **FileId** (string) - Required - The ID of the file. - **FileName** (string) - Required - The name of the file. #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **file** (binary) - The file content. #### Response Example (Binary file data not representable in JSON) ``` -------------------------------- ### Journal Post Number Return (JSON) Source: https://help.afas.nl/se/index_page=41 Example showing the JSON structure for receiving the journal post number following an INSERT or UPDATE with the FiEntries connector. ```json {"results":{"FiEntryPar":{"UnId":"1","EnNo":"5789"}}} ``` -------------------------------- ### Invoice Number Return (XML) - No Manual Entry Source: https://help.afas.nl/se/index_page=41 XML example for an INSERT operation where no invoice number is provided, resulting in an empty 'InId' tag. ```xml 15800 ``` -------------------------------- ### GET /profitrestservices/connectors/ Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves data from a specified connector in the AFAS system. It requires the connector name as a path parameter. ```APIDOC ## GET /profitrestservices/connectors/ ### Description Retrieves data from a specific connector endpoint. ### Method GET ### Endpoint /profitrestservices/connectors/ ### Parameters #### Path Parameters - **name** (string) - Required - The name of the connector to retrieve data from. #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **data** (object) - The retrieved connector data. #### Response Example { "data": "connector response object" } ``` -------------------------------- ### Invoice Number Return (XML) - Manual Entry Source: https://help.afas.nl/se/index_page=41 XML example showing the 'InId' tag being populated with a manually provided invoice number after an INSERT via the FiEntries connector. ```xml 15801FACTUUR V999 ``` -------------------------------- ### Submit OCI Product Data via HTML Form Source: https://help.afas.nl/se/index_page=6 Example HTML form for submitting product data from a supplier's webshop back to AFAS InSite. This form posts data including item code, description, quantity, unit, and pricing information. The action URL should match the HOOK_URL received in step 1 of the OCI process. ```html
``` -------------------------------- ### GET /profitrestservices/imageconnector/ Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves an image by its ID. It requires the image ID as a path parameter. ```APIDOC ## GET /profitrestservices/imageconnector/ ### Description Retrieves a specific image. ### Method GET ### Endpoint /profitrestservices/imageconnector/ ### Parameters #### Path Parameters - **ImageId** (string) - Required - The ID of the image to retrieve. #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **image** (binary) - The image content. #### Response Example (Binary image data not representable in JSON) ``` -------------------------------- ### Journal Post Number Return (XML) Source: https://help.afas.nl/se/index_page=41 Example demonstrating the XML format for returning the journal post number after an INSERT or UPDATE operation using the FiEntries connector. ```xml 15811 ``` -------------------------------- ### GET /connectors - Sorting Source: https://help.afas.nl/se/index_page=10 Retrieve data from a connector with sorting applied. Sorting can be ascending or descending based on specified fields. ```APIDOC ## GET /connectors ### Description Retrieve data from a connector with sorting applied. Sorting can be ascending or descending based on specified fields. ### Method GET ### Endpoint /connectors?orderbyfieldids=-Field1%2C-Field2 ### Parameters #### Query Parameters - **orderbyfieldids** (string) - Required - Comma-separated list of fields to sort by. Prefix with '-' for descending order. ### Request Example Not applicable (GET request with query parameters) ### Response #### Success Response (200) Returns the sorted data from the specified connector. #### Response Example { "data": [ { "Field1": "value1", "Field2": "value2" } ] } ``` -------------------------------- ### GET /connectors - Filtering Source: https://help.afas.nl/se/index_page=10 Retrieve data from a connector with filtering applied. Filters can be simple or complex, supporting various operators. ```APIDOC ## GET /connectors ### Description Retrieve data from a connector with filtering applied. Filters can be simple or complex, supporting various operators. ### Method GET ### Endpoint /connectors/connectorname?filterfieldids=[Field]&filtervalues=[Value]&operatortypes=[Type] ### Parameters #### Query Parameters - **filterfieldids** (string) - Required - Field name to filter on. - **filtervalues** (string) - Required - Value to filter by. - **operatortypes** (integer) - Required - Operator type for the filter (1-14). ### Operators 1. is gelijk aan (equals) 2. is groter of gelijk aan (greater than or equal) 3. is kleiner of gelijk aan (less than or equal) 4. is groter dan (greater than) 5. is kleiner dan (less than) 6. tekst komt voor in veld (contains) 7. is niet gelijk aan (not equals) 8. veld is leeg (is empty) 9. veld is niet leeg (is not empty) 10. veld begint met tekst (starts with) 11. is niet gelijk aan / tekst komt niet voor in veld (not equals / does not contain) 12. veld begint niet met tekst (does not start with) 13. veld eindigt met tekst (ends with) 14. veld eindigt niet met tekst (does not end with) ### Request Example Not applicable (GET request with query parameters) ### Response #### Success Response (200) Returns the filtered data from the specified connector. #### Response Example { "data": [ { "Field": "value" } ] } ``` -------------------------------- ### GET / (Notification Hub availability) Source: https://help.afas.nl/se/index_page=20 Checks reachability of the PCC Notification Hub used by AFAS Pocket and PCC applications over the public internet. ```APIDOC ## GET / ### Description Verifies that the AFAS PCC Notification Hub is reachable from client networks over the internet. ### Method GET ### Endpoint https://pc**.notificationhub.afas.online/ ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example GET https://pc**.notificationhub.afas.online/ HTTP/1.1 Host: pc**.notificationhub.afas.online ### Response #### Success Response (200) - Notification Hub reachable over HTTPS #### Response Example HTTP/1.1 200 OK ### Notes - Hostname must be whitelisted at the firewall/proxy. - Allowlist the associated public IPs and ensure outbound access to 443/tcp. - For TLS, use supported ciphers listed below. - SSL-scanning, HTTPS inspection, DPI, or IPS may impact performance and cause errors. ``` -------------------------------- ### GET /profitrestservices/reportconnector/ Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves a report based on the report ID. It requires the report ID as a path parameter. ```APIDOC ## GET /profitrestservices/reportconnector/ ### Description Retrieves a specific report. ### Method GET ### Endpoint /profitrestservices/reportconnector/ ### Parameters #### Path Parameters - **ReportID** (string) - Required - The ID of the report to retrieve. #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **report** (object) - The report data. #### Response Example { "report": "report object" } ``` -------------------------------- ### GET /connectors - Complex Filtering Source: https://help.afas.nl/se/index_page=10 Retrieve data from a connector with complex filtering, supporting AND/OR operations on multiple fields. ```APIDOC ## GET /connectors ### Description Retrieve data from a connector with complex filtering, supporting AND/OR operations on multiple fields. ### Method GET ### Endpoint /connectors/connectorname?filterfieldids=[Field1]%2C[Field2]&filtervalues=[Value1]%2C[Value2]&operatortypes=[Type1]%2C[Type2] ### Parameters #### Query Parameters - **filterfieldids** (string) - Required - Comma-separated list of field names to filter on. - **filtervalues** (string) - Required - Comma-separated list of values to filter by. - **operatortypes** (string) - Required - Comma-separated list of operator types for the filters. ### AND Filter Example /connectors/Profit_Article?filterfieldids=ModifiedDate%2CArtGroup&filtervalues=2019-01-01T00%3A00%2C100&operatortypes=2%2C1 ### OR Filter Example /connectors/connectorname?filterfieldids=[Field1]%3B[Field2]&filtervalues=[Value1]%3B[Value2]&operatortypes=[Type1]%3B[Type2] ### Request Example Not applicable (GET request with query parameters) ### Response #### Success Response (200) Returns the filtered data from the specified connector. #### Response Example { "data": [ { "Field1": "value1", "Field2": "value2" } ] } ``` -------------------------------- ### GET /profitrestservices/subjectconnector// Source: https://help.afas.nl/se/index_page=6 This endpoint retrieves a file associated with a specific subject. It requires subject ID and file ID as path parameters. ```APIDOC ## GET /profitrestservices/subjectconnector// ### Description Retrieves a specific file linked to a subject. ### Method GET ### Endpoint /profitrestservices/subjectconnector// ### Parameters #### Path Parameters - **SubjectId** (string) - Required - The ID of the subject. - **FileId** (string) - Required - The ID of the file to retrieve. #### Query Parameters - None #### Request Body - None ### Request Example No request body required. ### Response #### Success Response (200) - **file** (binary) - The file content. #### Response Example (Binary file data not representable in JSON) ``` -------------------------------- ### Download File from Profit Source: https://help.afas.nl/se/index_page=39 Retrieves a file from Profit. Requires the GUID and original filename of the attachment, which can be obtained using GetConnector. The FileConnector can only be used for downloading if the SubjectConnector is activated. ```APIDOC ## GET /fileconnector/{GUID}/{filename} ### Description Retrieves a file from Profit using its GUID and original filename. ### Method GET ### Endpoint `/fileconnector/{GUID}/{filename}` ### Parameters #### Path Parameters - **GUID** (string) - Required - The unique identifier of the file attachment. - **filename** (string) - Required - The original filename of the attachment, including its extension. Special characters must be URL-encoded. ### Request Example ``` /fileconnector/F64BB8E942BBC5E94FC747904E19FE1B/Invoice3734.pdf ``` ### Response #### Success Response (200) - **file content** (binary/base64 string) - The content of the requested file. #### Response Example (Binary file content or Base64 encoded string) ### Error Handling - **HTTP 404 File not found**: Returned if the file does not exist or if the user lacks permissions. Verify file existence and authorization settings. Ensure user groups have the necessary permissions for dossier items. ``` -------------------------------- ### Invoice Number Return (XML) - Auto-numbering Source: https://help.afas.nl/se/index_page=41 XML example illustrating how the invoice number is returned in the 'InId' tag when using auto-numbering during an INSERT operation with FiEntries. ```xml 15802V0002614 ``` -------------------------------- ### GET /Profitrestservices/connectors/{connectorName} Source: https://help.afas.nl/se/index_page=75 Calls a GetConnector to retrieve data from AFAS Profit. Requires Base64-encoded AFAS token in Authorization header for Profit 7 and later versions. ```APIDOC ## GET /Profitrestservices/connectors/{connectorName} ### Description Retrieves data from AFAS Profit using a GetConnector. The connector name must be specified in the URL path. ### Method GET ### Endpoint https://[environment].afas.nl/Profitrestservices/connectors/{connectorName} ### Parameters #### Path Parameters - **connectorName** (string) - Required - Name of the connector to call #### Header Parameters - **Authorization** (string) - Required - Value must be 'AfasToken ' followed by the Base64-encoded XML token ### Request Example ```http GET https://12345.afas.nl/Profitrestservices/connectors/Profit_Article Authorization: AfasToken PEtkb20+PHZlcnNpb24+MTwvdmVyc2lvbj48ZGF0YT48IVtDREFUQVswRTY4MjQ2OTlGNDgxMjlFMjU0REI5NjQ0MTIzM0UzMkYxMzQ1NDM1NTE4NEU1QTI0RjhFM0MwREZBNEY=XV0+PC9kb20+ ``` ### Response #### Success Response (200) - **data** (array) - Array of records returned by the connector #### Response Example ```json { "data": [ { "ArticleCode": "ART001", "Description": "Sample Article" } ] } ``` ``` -------------------------------- ### Delete Memorial Booking (XML) Source: https://help.afas.nl/se/index_page=41 XML example for deleting a memorial booking using the UpdateConnector FiEntries. Note that only full bookings can be deleted, and 'InId' must be specified. ```xml 15803MEMORIAL_BOOKING_REF ``` -------------------------------- ### Invoke AFAS REST Connector Calls with PowerShell Source: https://help.afas.nl/se/index_page=75 These PowerShell scripts encode the AFAS XML token to Base64 and use it in the Authorization header for REST API requests via Invoke-WebRequest. Requires PowerShell on Windows, a valid token, and full URL (obtained from connect.afas.nl test tooling). First example retrieves and saves connector data to JSON file; second fetches meta-info. Outputs depend on endpoint; supports HTTPS only, no error handling shown. ```powershell $token = '10E6824699F40129E254DB96441233E32F13454355184E5A24F8E3C0DFA4F' $encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token)) $authValue = "AfasToken $encodedToken" $Headers = @{ Authorization = $authValue } $url = 'https://......./Profitrestservices/connectors/Profit_Article' $file = '\\yourserver\volume\folder\Getconnector.json' Invoke-WebRequest -Uri $url -OutFile $file -Headers $Headers ``` ```powershell $token = '10E6824612043AA9E254DB961223DD33E32F14943D93184E5A234553C0DFA4F' $encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token)) $authValue = "AfasToken $encodedToken" $Headers = @{ Authorization = $authValue } Invoke-WebRequest -Uri 'https://....../Profitrestservices//metainfo' -Headers $Headers ``` -------------------------------- ### GET /connectors/{connectorname} Source: https://help.afas.nl/se/index_page=10 Retrieve data from an AFAS connector with optional filtering. Supports simple filters via query parameters and complex filters generated from the AFAS Connect UI. ```APIDOC ## GET /connectors/{connectorname} ### Description This endpoint retrieves data from a specified AFAS connector. Filtering can be applied using query parameters to narrow results. Simple filters use semicolon-separated values, while complex filters (with AND/OR combinations) are built using the AFAS Connect REST/JSON interface, which generates the full URL with parameters. ### Method GET ### Endpoint /connectors/{connectorname} ### Parameters #### Path Parameters - **connectorname** (string) - Required - The name of the connector, e.g., Profit_Article. #### Query Parameters - **filterfieldids** (string) - Optional - Semicolon-separated (%3B) list of field IDs to filter on. Example: ArtGroup%3BArtGroup - **filtervalues** (string) - Optional - Semicolon-separated list of filter values corresponding to the field IDs. For empty checks, use null or empty string. Example: 100%3B200 - **operatortypes** (string) - Optional - Semicolon-separated list of operator types (numbers 1-14) for each filter. Example: 1%3B1 Operator Types: - 1: Is equal to - 2: Is greater than or equal to - 3: Is less than or equal to - 4: Is greater than - 5: Is less than - 6: Text contains (wrap value in %...%, e.g., %Microsoft%) - 7: Is not equal to - 8: Field is empty (set filtervalues to null or empty string) - 9: Field is not empty (set filtervalues to null or empty string) - 10: Field starts with text (append % to value, e.g., Microsoft%) - 11: Text does not contain (wrap value in %...%, e.g., %Microsoft%) - 12: Field does not start with text (append % to value, e.g., Microsoft%) - 13: Field ends with text (prepend % to value, e.g., %Microsoft) - 14: Field does not end with text (prepend % to value, e.g., %Microsoft) For complex filters (AND/OR combinations), build the filter in AFAS Connect under REST/JSON / GetConnectors, enable JSON filter, and use the generated URL. #### Request Body None (GET request) ### Request Example https://[endpoint]/connectors/Profit_Article?filterfieldids=ArtGroup%3BArtGroup&filtervalues=100%3B200&operatortypes=1%3B1 ### Response #### Success Response (200) Returns a JSON object containing the filtered connector data. Structure varies by connector. Example: {"data": [...]} #### Response Example { "data": [ { "field": "value" } ] } #### Error Responses - 400 Bad Request: Invalid filter parameters - 401 Unauthorized: Authentication required - 404 Not Found: Connector not found ``` -------------------------------- ### Create Symbolic Link (Windows Command Prompt) Source: https://help.afas.nl/se/index_page=28 Demonstrates how to create a symbolic link in the Windows command prompt to map a cloud-based folder to a local drive for easier access within AFAS Online. This process requires administrator privileges and needs to be configured individually or centrally. ```commandline mklink /d C:\AFAS\ "C:\Users\Peter\OneDrive\AFAS" ``` ```commandline mklink /d C:\SharePoint \\klant.sharepoint.com@SSL\DavWWWRoot\ ``` -------------------------------- ### POST /GetDataWithOptions Source: https://help.afas.nl/se/index_page=93 Retrieves data with additional options such as pagination (Skip/Take) and sorting (Index). Requires the same authentication as GetData plus an Options XML block. ```APIDOC ## POST GetDataWithOptions ### Description Retrieves data from a connector while allowing extra options like pagination (Skip/Take) and sorting (Index). Implemented via the SOAP call GetDataWithOptions. ### Method POST ### Endpoint /GetDataWithOptions ### Parameters #### Request Body - **token** (string) - Required - User token wrapped in CDATA. - **ConnectorId** (string) - Required - Name of the GetConnector. - **filtersXml** (string) - Optional - XML string defining filters. - **options** (string) - Optional - XML block containing Skip, Take, Index and related settings. ### Request Example { "token": "", "ConnectorId": "MyConnector", "filtersXml": "...", "options": "010" } ### Response #### Success Response (200) - **data** (XML) - The requested data set respecting the supplied options. ### Response Example { "data": "..." } ``` -------------------------------- ### POST /profitservices (SOAP/XML Production) Source: https://help.afas.nl/se/index_page=6 SOAP/XML service endpoints for the Production environment. Use POST requests with a SOAP envelope to interact with various connector services and token management. ```APIDOC ## POST https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorget.asmx ### Description Retrieves data via the AppConnectorGet service. ### Method POST ### Endpoint https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorget.asmx ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required - Your participant number (e.g., 12345). #### Request Body - **SOAPEnvelope** (XML) - Required - SOAP envelope containing the request. ### Request Example { "SOAPEnvelope": "..." } ### Response #### Success Response (200) - **SOAPEnvelope** (XML) - SOAP response envelope. ### Response Example { "SOAPEnvelope": "..." } --- ## POST https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorupdate.asmx ### Description Updates data via the AppConnectorUpdate service. ### Method POST ### Endpoint https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorupdate.asmx ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required - Your participant number. #### Request Body - **SOAPEnvelope** (XML) - Required. ### Request Example { "SOAPEnvelope": "..." } ### Response #### Success Response (200) - **SOAPEnvelope** (XML) - Response. ### Response Example { "SOAPEnvelope": "..." } --- ## POST https://{ParticipantNumber}.soap.afas.online/profitservices/tokenconnector.asmx ### Description Handles token generation and validation. ### Method POST ### Endpoint https://{ParticipantNumber}.soap.afas.online/profitservices/tokenconnector.asmx ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. #### Request Body - **SOAPEnvelope** (XML) - Required. ### Request Example { "SOAPEnvelope": "..." } ### Response #### Success Response (200) - **SOAPEnvelope** (XML) - Response. ### Response Example { "SOAPEnvelope": "..." } --- ## POST https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorsubject.asmx ### Description Manages subject related operations. ### Method POST ### Endpoint https://{ParticipantNumber}.soap.afas.online/profitservices/appconnectorsubject.asmx ### Parameters #### Path Parameters - **ParticipantNumber** (string) - Required. #### Request Body - **SOAPEnvelope** (XML) - Required. ### Request Example { "SOAPEnvelope": "..." } ### Response #### Success Response (200) - **SOAPEnvelope** (XML) - Response. ### Response Example { "SOAPEnvelope": "..." } ``` -------------------------------- ### Execute UpdateConnector PUT request with PowerShell Source: https://help.afas.nl/se/index_page=8 The snippet demonstrates building an authentication token, setting required headers, and sending a JSON payload to a Profit UpdateConnector using PowerShell's Invoke-WebRequest. It requires a valid Profit token, the connector endpoint, and appropriate permissions. The response contains the result of the PUT operation. ```PowerShell $token = '112345678901234567890123456789012345678901234567890' $encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token)) $authValue = "AfasToken $encodedToken" $Headers = @{ Authorization = $authValue } $url = '/connectors/KnSubject' $file = '{ \"KnSubject\": { \"Element\": { \"@SbId\": 1957, \"Fields\": { \"Ds\": \" öndèrwérp aziëlaan JSON\" } } } }' Invoke-WebRequest -Uri $url -ContentType 'application/json;charset=utf-8' -Method PUT -Headers $Headers -Body $file ``` -------------------------------- ### XML Options Configuration for GetDataWithOptions Source: https://help.afas.nl/se/index_page=93 The GetDataWithOptions method extends GetData by accepting an XML string in the Options field to control output format (XML or CSV), metadata inclusion, pagination via skip/take for performance, and sorting with Index. Depends on AFAS Online SOAP API and valid login token. Inputs: XML options string, connector selection, filters. Outputs: Paginated records in specified format. Limitations: Keep [columns] x [take] < 150,000 to avoid memory errors; sorting on key fields required for skip/take. ```xml 0 10 ``` ```xml 1 0 ``` ```xml 1 1 ``` ```xml 2 ``` ```xml 1 0 0 5 ``` -------------------------------- ### Upload file to Profit using PowerShell FileConnector Source: https://help.afas.nl/se/index_page=39 This PowerShell snippet demonstrates how to upload a binary file to the Profit FileConnector endpoint using multipart/form-data. It reads the file, encodes it as UTF-8, constructs the request body with a generated boundary, and sends the POST request with TLS 1.2. Requires a valid $Headers variable containing authentication information. ```PowerShell $posturl = 'https://12345.rest.afas.online/ProfitRestServices/fileconnector/KnSubject/IMG_20202206_173801.jpg' $FilePath = "C:\\temp\\IMG_20200706_173801.jpg" $fileBytes = [System.IO.File]::ReadAllBytes($FilePath); $fileEnc = [System.Text.Encoding]::GetEncoding('UTF-8').GetString($fileBytes); $boundary = [System.Guid]::NewGuid().ToString(); $LF = "`r`n"; $bodyLines = ( "--$boundary", "Content-Disposition: form-data; name=\"file\"; filename=\"temp.txt\"", "Content-Type: application/octet-stream$LF", $fileEnc, "--$boundary--$LF" ) -join $LF [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $Result = Invoke-RestMethod -Uri $posturl -Headers $Headers -Method Post -ContentType "multipart/form-data; boundary=\"$boundary\"" -Body $bodyLines ``` -------------------------------- ### Obtain User Token Source: https://help.afas.nl/se/index_page=34 A user who has received an activation code can use this endpoint to request a user token. This process involves sending the OTP obtained from the previous step. ```APIDOC ## POST /profitservices/tokenconnector.asmx ### Description Obtains a user token for a Profit user by providing the activation code (OTP) previously received. This allows the user to authenticate with the app connector. ### Method POST ### Endpoint `/profitservices/tokenconnector.asmx` ### Parameters #### Request Body - **userId** (string) - Required - The Profit username. - **apiKey** (string) - Required - The API key of the app connector. - **environmentKey** (string) - Required - The environment key of the app connector. - **otp** (string) - Required - The one-time password (OTP) sent to the user. ### Request Example ```xml ExternalApp username your_api_key your_environment_key your_one_time_password ``` ### Response #### Success Response (200) Returns an XML response containing the user token, which can be used for subsequent authenticated requests. #### Response Example ```xml Profit your_user_token ``` ```