You are here

README.txt in Deploy Services Client 7

INTRODUCTION
------------

This module provides a Services client which communicates with Deployment
endpoints (see http://drupal.org/project/services and
http://drupal.org/project/deploy if you are unfamiliar with those terms).

It is intended for developers using Deployment and Services to push content
between sites who would like to easily perform other operations on the content
which the Deployment module does not directly support.

As an example, suppose you have pushed content to a site and would later like
to delete it.  Services supports deleting content (even though Deployment
doesn't), and you could theoretically write custom code to contact the site and
delete it, but in doing so you'll find yourself writing a lot of complex code
to duplicate some of the basic mechanics that you already have wrapped up in
your Deployment configuration (for example, finding the correct URL on the
target site to contact and figuring out how to authenticate with the target
site).

With this module, you can simply load up the Deployment endpoint and call a
single API function; the mechanics will be taken care of behind the scenes, and
your content on the target site will be deleted.

EXAMPLES
--------

The module provides several procedural wrappers for performing common tasks:

1. deploy_services_client_delete_entity_from_endpoint()
   Given a Deployment endpoint and an entity, delete the entity from the
   endpoint.

2. deploy_services_client_delete_entity_from_plan_endpoints()
   Same as above, but performs the action on all endpoints associated with a
   given Deployment plan.

3. deploy_services_client_unpublish_entity_from_endpoint()
   Given a Deployment endpoint and an entity, unpublish the entity on the
   endpoint.

4. deploy_services_client_unpublish_entity_from_plan_endpoints()
   Same as above, but performs the action on all endpoints associated with a
   given Deployment plan.

In addition, the module provides a DeployServicesClient class which can be used
to perform an arbitrary Services request on a given Deployment endpoint.
Example:

<?php
  $endpoint = deploy_endpoint_load('your_endpoint_name');
  $client = new DeployServicesClient($endpoint);
  $client->login();
  $response = $client->request('some/services/path/relative/to/the/endpoint/url', 'POST', drupal_json_encode($data_you_want_to_send));
  //
  // ... Do something with the $response ...
  //
  $client->logout();
?>

Note that the procedural wrappers assume that the UUID Services module is
installed on the target site (which is presumably the case if you are deploying
content to that site via Deployment in the first place) and, naturally, the
delete methods require that the target site is actually configured to allow the
Deployment user to delete entities via Services.

LIMITATIONS
-----------

The module currently makes a couple of hardcoded assumptions about the
Deployment endpoint:

1. It assumes a REST-based JSON communication method.
2. It assumes a session-based authentication method.

Also note that this is an API module only; there is no user interface, and
therefore no reason to install this module unless you are using it in code you
are writing or another module's installation instructions tell you to install
it.

CREDITS
-------

This project was sponsored by Advomatic (http://advomatic.com).

File

README.txt
View source
  1. INTRODUCTION
  2. ------------
  3. This module provides a Services client which communicates with Deployment
  4. endpoints (see http://drupal.org/project/services and
  5. http://drupal.org/project/deploy if you are unfamiliar with those terms).
  6. It is intended for developers using Deployment and Services to push content
  7. between sites who would like to easily perform other operations on the content
  8. which the Deployment module does not directly support.
  9. As an example, suppose you have pushed content to a site and would later like
  10. to delete it. Services supports deleting content (even though Deployment
  11. doesn't), and you could theoretically write custom code to contact the site and
  12. delete it, but in doing so you'll find yourself writing a lot of complex code
  13. to duplicate some of the basic mechanics that you already have wrapped up in
  14. your Deployment configuration (for example, finding the correct URL on the
  15. target site to contact and figuring out how to authenticate with the target
  16. site).
  17. With this module, you can simply load up the Deployment endpoint and call a
  18. single API function; the mechanics will be taken care of behind the scenes, and
  19. your content on the target site will be deleted.
  20. EXAMPLES
  21. --------
  22. The module provides several procedural wrappers for performing common tasks:
  23. 1. deploy_services_client_delete_entity_from_endpoint()
  24. Given a Deployment endpoint and an entity, delete the entity from the
  25. endpoint.
  26. 2. deploy_services_client_delete_entity_from_plan_endpoints()
  27. Same as above, but performs the action on all endpoints associated with a
  28. given Deployment plan.
  29. 3. deploy_services_client_unpublish_entity_from_endpoint()
  30. Given a Deployment endpoint and an entity, unpublish the entity on the
  31. endpoint.
  32. 4. deploy_services_client_unpublish_entity_from_plan_endpoints()
  33. Same as above, but performs the action on all endpoints associated with a
  34. given Deployment plan.
  35. In addition, the module provides a DeployServicesClient class which can be used
  36. to perform an arbitrary Services request on a given Deployment endpoint.
  37. Example:
  38. $endpoint = deploy_endpoint_load('your_endpoint_name');
  39. $client = new DeployServicesClient($endpoint);
  40. $client->login();
  41. $response = $client->request('some/services/path/relative/to/the/endpoint/url', 'POST', drupal_json_encode($data_you_want_to_send));
  42. //
  43. // ... Do something with the $response ...
  44. //
  45. $client->logout();
  46. ?>
  47. Note that the procedural wrappers assume that the UUID Services module is
  48. installed on the target site (which is presumably the case if you are deploying
  49. content to that site via Deployment in the first place) and, naturally, the
  50. delete methods require that the target site is actually configured to allow the
  51. Deployment user to delete entities via Services.
  52. LIMITATIONS
  53. -----------
  54. The module currently makes a couple of hardcoded assumptions about the
  55. Deployment endpoint:
  56. 1. It assumes a REST-based JSON communication method.
  57. 2. It assumes a session-based authentication method.
  58. Also note that this is an API module only; there is no user interface, and
  59. therefore no reason to install this module unless you are using it in code you
  60. are writing or another module's installation instructions tell you to install
  61. it.
  62. CREDITS
  63. -------
  64. This project was sponsored by Advomatic (http://advomatic.com).