Versions Compared

Key

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

...

Because resources are the most significant content returned from an API, we have provided the HTTP_Resource_Services module to help. By default, the SRP HTTP Framework returns resources in JSON format:

Code Block
languagejs
titlethemeJSON Resource ObjectDJango
collapsetrue
{
   "address":"6649 N Blue Gum St",
   "birthdate":"",
   "city":"New Orleans",
   "company":"Benton, John B Jr",
   "county":"Orleans",
   "email":"jbutt@gmail.com",
   "first_name":"James",
   "last_name":"Butt",
   "notes":"",
   "phone":[
      {
         "phone_number":"(504) 621-8927",
         "phone_type":"Phone 1"
      },
      {
         "phone_number":"(504) 845-1427",
         "phone_type":"Phone 2"
      }
   ],
   "state":"LA",
   "url":"http://www.bentonjohnbjr.com",
   "zip":"70116"
}

The Academic Answer

Let's also answer another question, "Why do we use the word resource?" The answer is because our method for referencing a resource, i.e., a URL, stands for Uniform Resource Locator. Since we are building web APIs that rely upon the standards for URIs (or URL) and the standards for HTTP, we want to use the terms already employed.

...