Profit Package Documentation

Profit Package Documentation

Profit Package Documentation

The Profit package is a Python package designed to retrieve specific GetConnectors defined by the user in their AFAS environment. It utilizes the SalureConnect package to securely retrieve the necessary credential information.

Table of Contents

  1. Installation
  2. Usage
  3. Class: GetConnector

Installation

The Profit package can be installed by simply importing it into your Python project:

pythonCopy code
  1. from profit import GetConnector

Usage

To use the Profit package, you'll first need to create an instance of the GetConnector class. Then, you can use the various methods provided by the class to interact with your AFAS environment.

  1. pythonCopy code
  2. from profit import GetConnector
  3. # Initialize the GetConnector class
  4. connector = GetConnector(label='your_label', test_environment=False, debug=False)
  5. # Retrieve metadata for a specific connector
  6. metadata = connector.get_metadata(connector='your_connector')
  7. # Retrieve data for a specific connector
  8. data = connector.get_data(connector='your_connector', fields='field1,field2', values='value1,value2', operators='1,1', orderbyfields='orderby_field')

Class: GetConnector

Methods

init(self, label: Union[str, List], test_environment: bool = False, debug: bool = False)

Initializes a new instance of the GetConnector class, which inherits from the SalureConnect class.

  • label: The label of the credential to be used.
  • test_environment: Optional. Set to True if you're working with a test environment. Defaults to False.
  • debug: Optional. Set to True to enable debugging output. Defaults to False.

get_metadata(self, connector: str = None)

Retrieves the metadata for a specific GetConnector or all GetConnectors if no connector is specified.

  • connector: Optional. The name of the GetConnector for which to retrieve metadata. Defaults to None.

get_data(self, connector, fields=None, values=None, operators=None, orderbyfields=None)

Retrieves data for a specific connector using filters and optional orderbyfields.

  • connector: The name of the connector to retrieve data from.
  • fields: Optional. A comma-separated string of field IDs for the filter.
  • values: Optional. A comma-separated string of filter values.
  • operators: Optional. A comma-separated string of filter operator types. See method documentation for a full list of available operators.
  • orderbyfields: Optional. A string of fields to order the result by. If you're using skip and take, it's highly recommended to specify orderbyfields to speed up the request.

get_complex_filtered_data(self, connector: str, fields: list, values: list, operators: list, orderbyfields: str = None)

Retrieves data for a specific connector using complex combined filters and optional orderbyfields.

  • connector: The name of the connector to retrieve data from.
  • fields: A list of filter blocks, where each list item is one filter block.
  • values: A list of filter values, where each list item corresponds to one filter block.
  • operators: A list of filter operator types, where each list item corresponds to one filter block. See method documentation for a full list of available operators

  • orderbyfields: Optional. A string of fields to order the result by. If you're using skip and take, it's highly recommended to specify orderbyfields to speed up the request.

get_dossier_attachments(self, dossieritem_id, dossieritem_guid) -> requests.Response

Retrieves the base64-encoded binary data of a dossier attachment as part of the response object's filedata key.

  • dossieritem_id: The ID of the dossier item.
  • dossieritem_guid: The GUID of the dossier item.

You can process the base64-encoded binary data by decoding it and writing it to a file like this:

  1. pythonCopy code
  2. import base64
  3. # Retrieve the attachment data
  4. response = connector.get_dossier_attachments(dossieritem_id='your_dossieritem_id', dossieritem_guid='your_dossieritem_guid')
  5. # Decode the base64-encoded binary data
  6. blob = base64.b64decode(response.json()['filedata'])
  7. # Write the decoded data to a file
  8. with open('your_file_directory/filename.ext', 'wb') as f: f.write(blob)
  9. f.write(blob)



    • Related Articles

    • BrynQ gebruikersaccount aanmaken in AFAS Profit

      Naast de mogelijkheid om in BrynQ nieuwe gebruikersaccounts aan te maken, is het ook mogelijk om een BrynQ gebruikersaccount aan te maken in AFAS Profit. Dit is uitsluitend mogelijk voor BrynQ-omgevingen die een koppeling hebben met AFAS Profit. Een ...
    • Salureconnect python documentatie

      SalureConnect SalureConnect is a Python package that handles the credential information between other packages and the web platform SalureConnect. The package simplifies the process of fetching and refreshing authentication credentials, as well as ...
    • Salurefunctions helpers

      SalureFunctions This module provides a class SalureFunctions which contains various utility functions that can be used for data processing and error handling in a data manipulation context. The class contains the following functions: applymap(key: ...
    • Single Sign On met AFAS Insite

      Het is mogelijk om de BrynQ dashboard in AFAS Insite te tonen, zodat je bijvoorbeeld dashboards kunt openen in Insite zonder nog een keer apart in te hoeven loggen. Voorwaarde is dat de AFAS gebruikerscode hetzelfde is als de gebruikerscode in BrynQ. ...
    • Organigram inrichten voor autorisatie

      Het organigram bepaalt wat gebruikers zien in de dashboards. Dit artikel beschrijft hoe het organigram ingericht kan worden en hoe gebruikers hieraan gekoppeld kunnen worden. Bronsystemen inladen In de meeste organisaties worden meerdere ...