thumb_up
thumb_down
link
Copy link
Copied
insert_emoticon
lmatfy
Copied

Profit REST Service UpdateConnector

An external application can use an UpdateConnector to add, change or delete records in the Profit database (options vary per connector). You can only call UpdateConnectors that have been activated in the App connector.

Contents

Available connectors

You view all GetConnectors and UpdateConnectors that are available for the Profit REST Services (these are the connectors that have been activated in the App connector).

To view available GetConnectors and UpdateConnectors:

  1. Call the Profit REST Services.
  2. Use the URL in /metainfo.
  3. Click on: GET.

    You see a list with all available connectors.

View UpdateConnector meta info

You can retrieve a list with the name, the description and all the fields of an UpdateConnector. In the field list, you see the field name, type, length, etc.

To view meta info:

  1. Call the Profit REST Services.
  2. Select a connector.
  3. Use the URL in /metainfo/update/.

Special characters

You must provide special characters (e.g. é, ü, ï) in the UTF-8 format. If you do not, Profit will show a question mark instead of, for example, é, ü or ï.

Note:

This topic is only intended for JSON. For XML, view this topic.

For Windows Powershell, you use the -ContentType 'application/json;charset=utf-8'.] parameter for a Invoke-WebRequest.

Example:

In this example the description of a dossier item is changed:

$token = '<token><version>1</version><data>12345678901234567890123456789012345678901234567890</data></token>'

$encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token))

$authValue = "AfasToken $encodedToken"

$Headers = @{

Authorization = $authValue

}

$url = 'https://12345.afasonlineconnector.nl/profitrestservices/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 $AuthHeaders -Body $file

Run an UpdateConnector

An external application can use an UpdateConnector to add, change or delete records in the Profit database (options vary per connector). You can only call UpdateConnectors that have been activated in the App connector.

Use one of these methods:

  • POST: add data (INSERT)
  • PUT: change data (UPDATE)
  • DELETE: delete data

For REST you cannot to add and change data in one combined call. You can do this using XML, if the UpdateConnector is suitable for this purpose.

To run an UpdateConnector using the tool:

  1. Call the Profit REST Services.
  2. Select a connector for the correct method. The URL is displayed.
  3. Click on the action button to the right of the URL.
  4. Complete the fields. Mandatory fields are marked with an asterisk.
  5. Click on: Execute.
  6. You see the JSON code and the result of the call:

PUT code example

$token = '<token><version>1</version><data>5DEFA8EC26234BB2993040350BDAB18754DB8AF8484301AD1C6CB7BBA20AC16D</data></token>'

$encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token))

$authValue = "AfasToken $encodedToken"

$Headers = @{

Authorization = $authValue

}

$url = 'https://https://server.enyoi.com/Profitrestservices/connectors/KnSubject'

$file = '{

"KnSubject": {

"Element": {

"@SbId": 9769,

"Fields": {

"Ds": "Gewijzigd onderwerp JSON"

}

}

}

}'

Invoke-WebRequest -Uri $url -ContentType application/json -Method PUT -Headers $Headers -Body $file

POST code example

$token = '<token><version>1</version><data>5DEFA8EC26234BB2993040350BDAB18754DB8AF8484301AD1C6CB7BBA20AC16D</data></token>'

$encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token))

$authValue = "AfasToken $encodedToken"

$Headers = @{

Authorization = $authValue

}

$url = 'https://server.enyoi.com/Profitrestservices/connectors/KnSubject'

$file = '{

"KnSubject": {

"Element": {

"@SbId": 2,

"Fields": {

"StId": 2,

"Ds": "Uitgaande telefoongesprek",

"St": true,

"SbBl": true

},

"Objects": {

"KnSubjectLink": {

"Element": {

"@SbId": 2,

"Fields": {

"SfTp": 3,

"SfId": "666"

}

}

}

}

}

}

}'

Invoke-WebRequest -Uri $url -ContentType application/json -Method POST -Headers $Headers -Body $file

DELETE code example

$token = '<token><version>1</version><data>5DEFA8EC26234BB2993040350BDAB18754DB8AF8484301AD1C6CB7BBA20AC16D</data></token>'

$encodedToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($token))

$authValue = "AfasToken $encodedToken"

$Headers = @{

Authorization = $authValue

}

$url = 'https://https://server.enyoi.com/Profitrestservices/connectors/KnSubject/KnSubject/@SbId/2'

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

Process

Profit REST Service

Work area

connectoren