Skip to content

Instantly share code, notes, and snippets.

@atrauzzi
Last active November 12, 2015 04:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atrauzzi/6f1c361f4ab0bb0ee1a3 to your computer and use it in GitHub Desktop.
Save atrauzzi/6f1c361f4ab0bb0ee1a3 to your computer and use it in GitHub Desktop.
# Quesedeals
General docs can be found here:
http://drupalcode.org/project/restws.git/blob_plain/d371e6e274d9f3ad15de1c2bf15e45874ce008d3:/README.txt
What follows is the guts of what you're after...
## Endpoints
Druplol uses a node system to store everything. So most of the data with exception to comments and categories are all part of the same data set, differentiated by a "type" field.
### Categories
```
/taxonomy_term.json - INDEX
/taxonomy_term/{id}.json - SHOW
```
### Shops
```
/node.json?type=tienda - INDEX
/node.json?nid={nid} - SHOW
```
### Deals
```
/node.json?type=wp_blog - INDEX
/node.json?nid={nid} - SHOW
```
#### Hotness
Hotness is determined by the attribute `field_wp_blog_opc` containing the value `Hot`
#### Expired
Expiry is determined by using the timestamps found under `field_wp_blog_fec`. Within that structure, `value` is the start date for the deal and `value2` is the end date. There's also a `duration` field in there which may or may not be useful.
### Comments
```
/comment.json - INDEX
/comment/{id}.json - SHOW
```
## Meta
## .json
When fetching related data found inside a result set, it may point to a resource that 404s on you. In those instances, add the `.json` extension to see the representation. This is especially common with images where you have to get the image's object before you can get the canonical URL to the image file.
## Filtering
Filtering is accomplished by adding `GET` parameters to the URL for the value. In the case of a collection of objects (taxonomies), the object's key is what you want.
eg: `http://www.promodescuentos.com/node.json?type=wp_blog&taxonomy_wp_blog_tags=18`
## Order
You can control the sort order of items by supplying `direction` as `DESC` or `ASC` as part of your `GET` query. You can choose which field to sort by, by setting `sort` as the name of the field you want to sort by in your `GET` query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment