Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In each of our APIs there is a call into the LoremIpsum service (a member of the HTTP_Resource_Services module). The purpose of this special service is to enable the new API to produce sample content so the API can be tested immediately (see our How do a I create an API? article for an example of this).

...

We'll assume that our APIs are responding properly to requests so we are now ready to make our APIs function the way we want. The way this gets done can vary greatly based on the nature of the resource, the purpose of the API, and the overall design intent of the application. In simple cases where the resource is related to a database table, we can use some high-level services to make this quick and easy. Since our customers resource is related to the CUSTOMERS database table, we'll update our API commuter module as follows:

...

Obviously there is a lot of automation going on within these services. Depending upon your needs, your code might look very different. We encourage you to start with our How do I create a resource? article to get a feel for the different ways this task can be approached.

Image Added

In Summary

Hopefully this illustration encourages you to use the SRP HTTP Framework with a sense of confidence. Quite often the developer just repeats the above steps as new resources are added to the application or when existing resources are updated (e.g., adding a new method an endpoint). There are other important elements that this article did not explore, such as authentication, authorization, unique resource media types, hypermedia, etc., but these will all come in good time and will be easier to implement once you master the basics.