You are here: Home / Documentation / 6. Add-ins / 6.6 eWay-CRM API / Basics of eWay-CRM API

Basics of eWay-CRM API

This article serves as a basic introduction for the work with the eWay-CRM API. In this simple example you will learn how to create simple code, which will create a new contact in eWay-CRM. Supplementary eWayConnector PHP class can be downloaded GitHub. If you are not familiar with PHP, you can also check out the C# helping library also on GitHub.

Important: To initialize instance of the eWayConnector class ('http://web_service_address/WcfService/Service.svc/', 'user', 'password'), you need address of the eWay-CRM web service and some username with password. Web service and user with correct password must exist.

<?php
require_once('eway.class.php');
$connector = new eWayConnector('http://web_service_address/WcfService/Service.svc/', 'user', 'password');
$contact = array(
'FirstName' => 'John',
'LastName' => 'Doe',
'Email1Address' => '[email protected]ple.com'
);
// Save new contact
$result = $connector->saveContact($contact);
if ($result->ReturnCode == 'rcSuccess')
{
echo "New contact created with Guid {$result->Guid}";
}
else
{
echo "Unable to create new contact: {$result->Description}";
}

List of methods available in the eWay-CRM API

Documentation of methods is available right from the web service. You can check whether the documentation is available on your web service. Go to the following URL in your web browser:

http://web_service.com/WcfService/Service.svc/help

Instead of http://web_service.com insert your real web service server.

If the documentation is not activated, you will see this text:

If you want to activate API documentation on your web service, the help page has to be enabled. This you can achieve by your self only if you host eWay-CRM server component on your own server. If eWay-CRM server component is hosted on cloud, you need to contact eWay-CRM customer support to enable it for you. The enabling steps are as follows:

    1. Go to your web service folder and open WcfService folder. There is Web.config file - open it for editing.
    2. There is <behaviors> in the code. You need to add helpEnabled="true" value to the webHttp parameter (see picture below).

    1. Save your changes.
    2. Now, use this link in your web browser:
http://webova_sluzba.com/WcfService/Service.svc/help
    1. You should see list of all methods that you can use in eWay-CRM API.

  1. Click POST and details about method will be displayed. For example, in the GetContacts methods, you will see all parameters you can work with (the picture below shows only part of the page for the GetContacts method).