Integrator API allows you to utilize all functions avalable at UMapper.com directly from your own website. This is done by relying on XML-RPC protocol. If you are new to RPC - start with our tutorial.
In a nutshell, RPC (or Remote Procedure Calls, hence the name RPC) allows you to trigger the procedures located on UMapper.com directly from your PHP application. It is a de facto standard in IT industry, so costs of integration are low.
General operation sequence when using API would be as following:
To get you started quickly we have prepared an easy to follow tutorial describing the remote method invocation.
Arguably the most easy way to utilize the XML-RPC protocol is to use Zend Framework - it has a very rich library of classes. For those who doesn't want to use full Zend Framework, we prepared the Integrator Toolkit. Toolkit contains only those ZF classes that are required to successfully run the XML-RPC client.
All examples are written in PHP5 and use Zend Framework. Thus, in order to be able to run the samples, you either have to install Zend Framework, or use Integrator Toolkit.
IMPORTANT! All XML-RPC requests should be forwarded to
You would need to provide valid credentials in order to use Integrator API. Sandbox credentials:
1 2 3 | Client username: UMapperTester Client password: password API Key: test |
All new accounts and maps, added via sandbox account, would be purged once a day at 00:00 GMT
In order to check whether your application is able to "talk" to UMapper servers, we have implemented test() method:
Definition: Test function to check whether server responds or not.
| Name | Type | Description |
|---|---|---|
| boolean | $throwException | Flag. Defines whether exception should be produced as result - it is usefull when testing how exceptions are thrown by UMapper servers. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // invoke api.test() method $response = $client->call('api.test'); // dump the results Zend_Debug::dump($response); } catch (Exception $e){ die($e->getMessage()); } |
Output:
1 | string(20) "RPC Call Sucessfull!" |
If everything goes all right, then you should get the "RPC Call Sucessfull!" message in your browser. If you wanted to test how exceptions are thrown you shuold pass additional parameter to $client->call():
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // invoke api.test() method; pass $throwException = true $response = $client->call('api.test', array(true)); // dump the results Zend_Debug::dump($response); } catch (Exception $e){ Zend_Debug::dump($e); } |
UMapper server responds with an exception, which may have the following dump:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | object(Zend_XmlRpc_Client_FaultException)#14 (6) { ["message:protected"] => string(15) "Error Occured!!" ["string:private"] => string(0) "" ["code:protected"] => int(404) ["file:protected"] => string(51) "/Zend/XmlRpc/Client.php" ["line:protected"] => int(261) ["trace:private"] => array(1) { [0] => array(6) { ["file"] => string(66) "/www/umapper.com/client.php" ["line"] => int(12) ["function"] => string(4) "call" ["class"] => string(18) "Zend_XmlRpc_Client" ["type"] => string(2) "->" ["args"] => array(2) { [0] => string(8) "api.test" [1] => array(1) { [0] => bool(true) } } } } } |
The very first thing you'd want to do when using the API is to connect to UMapper system. This is accomplished via api.connect() method. Here is the syntax:
Def: You feed this function your credentials and it returns the valid session token you would be using for any successive call to Integrator API.
| Name | Type | Description |
|---|---|---|
| string | $user | Your client (sub-system) username. Please note, that it's NOT a username you are using to login into your account here on UMapper.com. You would receive special integrator username and password, along the integrator API key upon request. In order to test the system use "UMapperTester" username. |
| string | $pass | Your client (sub-system) password's MD5 hash. Do not provide raw password - hash it with md5(). In order to test the system use md5('password') as your credential. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /** * Zend_Debug */ require_once 'Zend/Debug.php'; /** * Zend_XmlRpc_Client */ require_once 'Zend/XmlRpc/Client.php'; // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // setup connection parameters (below are sanbox details) $params = array( 'username' => 'UMapperTester', 'password' => md5('password'), 'key' => 'test', ); // invoke RPC method call and get the result into $response variable $response = $client->call('api.connect', $params); // dump the results Zend_Debug::dump($response); } catch (Exception $e){ die($e->getMessage()); } |
Output:
1 | string(32) "5e63dd036104a157419fe7117c891480" |
As you can see, we do not have to worry about XML being transfered back and forth between your site and UMapper - everything is abstraced in Zend_XmlRpc_Client class. The resultant string (which we saved in $response variable) is your session token, and could be used for successive calls right away.
Integrator API allows you to create user accounts that would be stored within UMapper system, and could be used for map assignment.
Definition: Adds new user account to specified user system. Returns new accounts DB primary key, if call succeed.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| string | $username | Username of new user account. |
| string | $password | Password of new user. Password should be provided as md5() hash. |
| string | $fname | First name. |
| string | $lname | Last Name. |
| string | Valid user e-mail. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // prepare user account struct $params = array( 'token' => $token, // use obtained token 'key' => 'test', 'username' => 'torio', 'password' => md5('topsecret'), 'fname' => 'Vitorio', 'lname' => 'Picienza', 'email' => 'googler@gmail.com' ); // invoke api.NewUser $accountId = $client->call('api.newUser', $params); // dump the results Zend_Debug::dump($accountId); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output (newly created account id):
1 | int(2174) |
When you need to re-check user account's details you should resort to api.getUser():
Definition: Returns user data as associative array.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| string|int | $user | Username or user ID. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // invoke api.getUser() //$params = array($token, 'test', 2174); //you can also use user ID $params = array($token, 'test', 'torio'); $accountData = $client->call('api.getUser', $params); // dump the results Zend_Debug::dump($accountData); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 2 3 4 5 6 7 8 9 10 11 | array(9) { ["id"] => string(4) "2174" ["accountType"] => string(1) "0" ["clientId"] => string(1) "2" ["username"] => string(5) "torio" ["fname"] => string(7) "Vitorio" ["lname"] => string(8) "Picienza" ["email"] => string(17) "googler@gmail.com" ["loginDate"] => string(19) "0000-00-00 00:00:00" ["currentSession"] => string(0) "" } |
Sometimes, you have username and want to retrieve account ID for that username, api.getUserId() is exactly for that:
Definition: Returns user ID from username.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| string | $user | Username. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // invoke api.getUserId() $params = array($token, 'test', 'torio'); $accountData = $client->call('api.getUserId', $params); // dump the results Zend_Debug::dump($accountData); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 | int(2174) |
When you need to update specific user account, use api.editUser():
Definition: Edits user account for a given sub-system, number of rows updated returned (if operation succeeds, obviously equals to one - 1).
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int | $uid | User ID of an edited account. Make sure that value provided is of integer type. |
| string | $username | New username for edited account. |
| string | $password | New password, provided only when update required. Password should be provided as md5() hash. |
| string | $fname | First name. |
| string | $lname | Last Name. |
| string | Valid user e-mail. |
Please note that $password, $fname, $lname, and $email are optional parameters.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // prepare updated user account struct $params = array( 'token' => $token, // use obtained token 'key' => 'test', 'uid' => 2174, // ID of updated user 'username' => 'torio_updated', 'password' => md5('topsecret'), 'fname' => 'Vito', 'lname' => 'Pici', 'email' => 'updated_googler@gmail.com' ); // invoke api.editUser() $response = $client->call('api.editUser', $params); Zend_Debug::dump($response); // should be equal to 1 // retrieve updated user data (via api.getUser()) $params = array($token, 'test', 'torio_updated'); $accountData = $client->call('api.getUser', $params); // dump the results Zend_Debug::dump($accountData); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 | int(1) array(9) { ["id"] => string(4) "2174" ["accountType"] => string(1) "0" ["clientId"] => string(1) "2" ["username"] => string(13) "torio_updated" ["fname"] => string(4) "Vito" ["lname"] => string(4) "Pici" ["email"] => string(25) "updated_googler@gmail.com" ["loginDate"] => string(19) "0000-00-00 00:00:00" ["currentSession"] => string(0) "" } |
In order to remove user account (registered with your website) from UMapper servers use api.deleteUser():
Definition: Removes user account from database, number of rows deleted returned (should be equal to 1).
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int | $uid | User ID of an account to be deleted. Make sure that value provided is an integer. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // get user ID $params = array($token, 'test', 'torio'); $accountId = $client->call('api.getUserId', $params); // remove account $params = array($token, 'test', $accountId); $response = $client->call('api.deleteUser', $params); Zend_Debug::dump($response); // should be equal to 1 } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 | int(1) |
In order to use the UMapper Map Editor, you have to create map record in our database and assign it to one of your users. All this could be done with api.creatMap() method:
Definition: Creates map (populates map meta-data), Map ID of newly created map record (or zero on error) is returned.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| array | $mapMeta |
Associative array containing map data.
e.g:
array( 'mapTitle' => 'Some Map', 'mapDesc' => 'Here goes some map description' ) |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // setup map data $mapData = array( 'mapTitle' => 'My Map', 'mapDesc' => 'Sample map created via API' ); // setup the payload parameters $params = array($token, 'test', 'torio', $mapData); // try to create new map for user "torio" $mapId = $client->call('api.createMap', $params); Zend_Debug::dump($mapId); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 | int(2072) |
Once map record is created you can retrieve its content by using api.getMapMeta() method:
Definition: Retrieves the map meta-data as associative array.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| int | $mapId | Map record ID of fetched map. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // get map meta-data for map 2071, assigned to user "torio" $params = array($token, 'test', 'torio', 2071); $mapData = $client->call('api.getMapMeta', $params); Zend_Debug::dump($mapData); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | array(12) { ["id"] => string(4) "2071" ["ownerId"] => string(4) "2175" ["mapTitle"] => string(6) "My Map" ["mapDesc"] => string(26) "Sample map created via API" ["viewCount"] => string(1) "0" ["commentCount"] => string(1) "0" ["dateCreated"] => string(19) "2008-08-20 19:22:10" ["providerId"] => string(1) "2" ["mapViewPerms"] => string(6) "anyone" ["mapEditPerms"] => string(2) "me" ["sessionId"] => string(32) "5e517cb211e022b4c7585513b800deb2" ["traversed"] => string(1) "1" } |
Map source data is stored in XML format (more specifically in highly extensible KML), an in order to load some map into UMapper Map Viewer or UMapper Map Editor, you would need an URI to the KML source file - api.getMapUri() was designed for such needs:
Definition: Returns the path of map file (currently in KML format).
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| int | $mapId | Map record ID of fetched map. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // get URI of map's KML file $params = array($token, 'test', 'torio', 2071); $mapUri = $client->call('api.getMapUri', $params); Zend_Debug::dump($mapUri); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 | string(49) "http://umapper.s3.amazonaws.com/maps/kml/2071.kml" |
Generally, it is safe to assume that map URI would be generated as following:
Still, the function would always return correct source path, so it is advised for forward-compatibility.
Once your map is created there may be situations when you need to update, say, map title or description - map meta data. This is done with api.updateMapMeta():
Definition: Updates map's meta-data. Number of rows updated is returned (generally 1, if operation succeeds).
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| int | $mapId | Map record ID of updated map. |
| array | $mapMeta |
Associative array containing map data.
e.g:
array( 'mapTitle' => 'Some Map', 'mapDesc' => 'Here goes some map description' ) |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // setup updated map data $mapData = array( 'mapTitle' => 'My Map Updated', ); // setup the payload parameters $params = array($token, 'test', 'torio', 2071, $mapData); // map ID 2071 // update map meta-data $response = $client->call('api.updateMapMeta', $params); Zend_Debug::dump($response); // should be 1 // get updated map data $params = array($token, 'test', 'torio', 2071); $mapUpdatedData = $client->call('api.getMapMeta', $params); Zend_Debug::dump($mapUpdatedData); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | int(1) array(12) { ["id"] => string(4) "2071" ["ownerId"] => string(4) "2175" ["mapTitle"] => string(14) "My Map Updated" ["mapDesc"] => string(26) "Sample map created via API" ["viewCount"] => string(1) "0" ["commentCount"] => string(1) "0" ["dateCreated"] => string(19) "2008-08-20 19:22:10" ["providerId"] => string(1) "2" ["mapViewPerms"] => string(6) "anyone" ["mapEditPerms"] => string(2) "me" ["sessionId"] => string(32) "5e517cb211e022b4c7585513b800deb2" ["traversed"] => string(1) "1" } |
Map source data is stored in XML format (more specifically in highly extensible KML), and method api.updateMapData is used to associate some KML data with certain map:
Definition: Updates map's KML data. Number of rows updated is returned (generally 1, if operation succeeds).
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| int | $mapId | Map record ID of updated map. |
| string | $mapData | XML string containing valid KML map. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // get mapData from file (just for readability) $mapData = file_get_contents(dirname(__FILE__) . '/myMap.xml'); // update map's KML data $params = array($token, 'test', 'torio', 2071, $mapData); $response = $client->call('api.updateMapData', $params); Zend_Debug::dump($response); } catch (Exception $e){ Zend_Debug::dump($e); } |
Contents of myMap.xml file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.1" xmlns:umapst="http://www.afcomponents.com/as3/umap/styles" xmlns:umap="http://www.afcomponents.com/as3/umap" > <Document> <name>Umapper.com</name> <description><![CDATA[My Map]]></description> <umap:UMapSettings xmlns:umap="http://www.afcomponents.com/as3/umap"> <provider> com.afcomponents.umap.providers.microsoft::MicrosoftProvider </provider> </umap:UMapSettings> </Document> </kml> |
Output:
1 | int(1) |
Believe it or not, but sometimes maps should be deleted, not surprisingly api.deleteMap() does exactly that:
Definition: Deletes map and corresponding resources, number of rows (generally 1) is returned.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
| int | $mapId | Map ID of deleted map. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // delete map and associated resources $params = array($token, 'test', 'torio', 2071); $response = $client->call('api.deleteMap', $params); Zend_Debug::dump($response); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 | int(1) |
In order to retrieve the list of maps associated with user account, use api.getMaps():
Definition: Returns array of maps, if any, registered with a given user account.
| Name | Type | Description |
|---|---|---|
| string | $token | Token identifying the session. This key is produced by initiating api.connect() method. |
| string | $key | In order to identify that requests are comming from valid client with non-expired credentials we need your integrator's API key - it is provided along the username and password. For testing purposes use the key "test". |
| int|string | $user | Username or user account ID. If argument is string, then it is assumed to be a username. Otherwise, user account ID is assumed. Map is associated with this ID. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require_once 'Zend/Debug.php'; // Zend_Debug require_once 'Zend/XmlRpc/Client.php'; // Zend_XmlRpc_Client // initialize RPC-client $client = new Zend_XmlRpc_Client( 'http://www.umapper.com/services/xmlrpc/integrator/' ); try { // connect, obtain valid session token $params = array('UMapperTester', md5('password'), 'test'); $token = $client->call('api.connect', $params); // get maps associated with user "torio" $params = array($token, 'test', 'torio'); $maps = $client->call('api.getMaps', $params); Zend_Debug::dump($maps); } catch (Exception $e){ Zend_Debug::dump($e); } |
Output:
1 2 3 4 5 6 7 | array(1) { [0] => array(3) { ["id"] => string(4) "2072" ["mapTitle"] => string(6) "My Map" ["viewCount"] => string(1) "0" } } |