Note: In all API calls, replace the % and example values between the % signs with your own variable values.
Get Currency
Replace %id% with the id of the group that you want to retrieve, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Retrieve currency by id.
- URL structure: http://crmme_url/index.php/zurmo/currency/api/read/%id%
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample:
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $id = 1; // Change this with value of currency id $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/currency/api/read/' . $id, 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $currency = $response['data']; //Do something with currency data } else { // Error, for example if we provided invalid currency id $errors = $response['errors']; // Do something with errors }
- Return:
Data contains currency info.
{ "status":"SUCCESS", "data":{ "id":1, "active":"1", "code":"USD", "rateToBase":"1" }, "message":null, "errors":null }
Get All Currencies
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Retrieve all currencies.
- URL structure: http://crmme_url/index.php/zurmo/currency/api/list/
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample:
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/currency/api/list/', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $currencies = $response['data']; //Do something with currencies } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains currencies.
{ "status":"SUCCESS", "data":{ "totalCount":"1", "currentPage":1, "items":[ { "id":1, "active":"1", "code":"USD", "rateToBase":"1" } ] }, "message":null, "errors":null }
List Currency Attributes
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: List currency attributes.
- URL structure: http://crmme_url/index.php/zurmo/currency/api/listAttributes
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/currency/api/listAttributes', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $currencyAttributes = $response['data']; //Do something with currency attributes } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains currency attributes info.
Comments