9. Do you want to learn
more?
Lorna Mitchell - REST for Web Developers
https://portland2013.drupal.org/node/1358
List of all Status Codes
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
10. Implement a REST client
• Test the 3rd party REST API
• Make a request
• Handle responses
• Write tests!
16. Handle responses
• Make sure exceptions are caught and
logged
• Convert the raw JSON data into resource
objects
17.
18. Write Tests!
• Drupal 7: DrupalWebTestCase
• Drupal 8: PHP Unit test framework
• One test for each function/request
• Test Driven Development (TDD)
https://github.com/daylerees/test-driven-
development-example
19. Keep in mind...
• Don’t reinvent the wheel (packagist.org,
github)
• Use Composer (http://getcomposer.org)
• PSR-0 Standard
https://github.com/php-fig/fig-standards/blob/
master/accepted/PSR-0.md
21. Drupal 7 - Services
• http://drupal.org/project/services
• Well established, lots of support modules
• Uses endpoints instead of resource paths
• Supports RPC and SOAP
• Only supports Drupal core entities
• Complex configuration options
22. Drupal 7 - Services Entity API
• http://drupal.org/project/services_entity
• Supports all entities through Entity API
• Configurable endpoints
23. Drupal 7 - RESTWS
• http://drupal.org/project/restws
• Uses Entity API
• No endpoints
• No configuration
• Cookie and Basic Auth
• Best candidate for RESTful service