AFASintegration

This page demonstrates the integration between AFAS InSite and your PHP installation. In the source of this PHP file index.php you can experience the ease of the integration with the PHP class file class.afasintegration.php.

PHP source

The code on the right is the only source could you will need to make the integration possible. These are your configuration parameters:

  • public_key
    The public key has been provided by AFAS Profit and allows you to know which integration page has requested your script.
  • private_key
    The private key has been provided by AFAS Profit and allows you to verify that you are allowed to use the integration.
  • validate_ssl
    Whether or not you wish to validate the SSL certificate of the InSite URL.
  • debug
    Whether or not you wish to include performance indicators in the data variable of the PHP class.
<?php
include_once ('class.afasintegration.php');
$config = array (
	'public_key' => 'YOUR_PUBLIC_KEY_HERE',
	'private_key' => 'YOUR_PRIVATE_KEY_HERE',
	'validate_ssl' => false,
	'debug' => true 
);
$AFASintegration = new AFASintegration ( $_REQUEST, $config );
?>

Request

The data contained in this block represents the initial request that was sent by the originating AFAS InSite to your integration page. This is what the different parameters mean:

  • dataurl
    Alternate url to be used for an integration without public and private keys.
  • tokenurl
    The url to which we will be making a postback to confirm the originating InSite page that we have a valid private key in order to receive the integrated details.
  • code
    The originating InSite expects this unique code in the postback for verification and identification purposes.
  • publickey
    The public key has been provided by AFAS Profit and allows you to know which integration page has requested your script.
  • sessionid
    This session id originates from the actual InSite session of the user, and allows you to make sure that you are still dealing with the same InSite user throughout requests.
array(0) {
}

Result

The result we show here contains the response given by the originating AFAS InSite integration page after the postback has been sent after the initial trigger request above.

  • environmentId
    The identifier of the AFAS Profit environment in which the InSite is hosted.
  • sessionId
    This session id originates from the actual InSite session of the user, and allows you to make sure that you are still dealing with the same InSite user throughout requests.
  • userId
    The username of the user which is logged in at InSite.
  • personCode
    The code of the registered person in AFAS Profit.
  • contactId
    The code of the registered contact in AFAS Profit.
  • organizationCode
    The code of the registered organization in AFAS Profit.
  • employeeId
    The code of the registered employee in AFAS Profit.
  • cssUrl
    Use the CSS-resource at this address to give your integrated page the same appearance as the originating InSite website.
  • scriptUrl
    Use the JavaScript-resource at this address to provide a complete integrated experience and allow for sizing-functionality.
array(2) {
  ["status"]=>
  int(500)
  ["message"]=>
  string(27) "An unexpected error occured"
}