Skip to content

Instantly share code, notes, and snippets.

@PCreations
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save PCreations/97d81fbe526384ea9c14 to your computer and use it in GitHub Desktop.

Select an option

Save PCreations/97d81fbe526384ea9c14 to your computer and use it in GitHub Desktop.
#listing all Option objects
GET /options/
#listing all Service objects
GET /services/
#adding a new Option object
POST /options/
#adding a new Service object
POST /services/
#retrieving a specific Option object
GET /options/1/ returns :
{
"url": "/options/1/",
"id": 1,
"name": "Option1",
"services": [
"/options/1/services/1/",
"/options/1/services/2/"
]
}
#retrieving a specific Service object
GET /services/1/ returns :
{
"url": "/services/1/",
"id": 1,
"name": "Service1"
}
#retrieving a specific OptionService relation:
GET /options/1/services/1/ returns :
{
"service": "/services/1/",
"price": "50.0"
}
#add a relation between pre-existing Option and Service object, thus creating a new OptionService object:
POST /options/2/services/1/
{
"price": "19.90"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment