Getting all property data via JSON api

Hi, the suggestion is to list all easyreservation data as json.

I’m building out most of the client view using AngularJS via JSON API calls to easy-rooms post types (great success). It may sound complicated but it really opens up WordPress to easier front-end dev. (no offence, but can you imagine learning a new set of shortcodes for each plugin, gets a little inefficient compared to knowing a few frameworks that expect json data)

Here’s a basic get request in Angular, with callback:

$http.get('http://localhost/vrqc/api/get_posts/?post_type=easy-rooms')
.success(function (data) {
console.log('propertiesData',data);
$scope.propertyData = data;
}).error(function (data) {
console.log('sucks');
});

Which yields an Array of property Objects, like so:


[{"id":111,"type":"easy-rooms","slug":"yet-another-resource","url":"http:\/\/localhost\/vrqc\/easy-rooms\/yet-another-resource\/","status":"publish","title":"Yet another resource","title_plain":"Yet another resource","content":"to play with\n","excerpt":"to play with\n","date":"2015-01-31 03:26:49","modified":"2015-01-31 04:55:41","categories":[],"tags":[],"author":{"id":1,"slug":"admin","name":"admin","first_name":"","last_name":"","nickname":"admin","url":"","description":""},"comments":[],"attachments":[{"id":112,"url":"http:\/\/localhost\/vrqc\/easy-rooms\/yet-another-resource\/web_72dpi-1210_s2b_livingrm_c-300x169\/","slug":"web_72dpi-1210_s2b_livingrm_c-300x169","title":"Web_72dpi-1210_S2B_livingrm_c-300x169","description":"","caption":"","parent":111,"mime_type":"image\/jpeg","images":{"full":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169},"medium":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169},"large":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169}}}],"comment_count":0,"comment_status":"open","thumbnail":null,"custom_fields":{"roomcount":["1"],"reservations_groundprice":["1000"],"easy-resource-interval":["2592000"],"easy-resource-req":["a:6:{s:10:\"nights-min\";s:1:\"1\";s:10:\"nights-max\";s:2:\"30\";s:8:\"pers-min\";s:1:\"1\";s:8:\"pers-max\";s:1:\"0\";s:8:\"start-on\";i:0;s:6:\"end-on\";i:0;}"],"easy-resource-price":["a:2:{i:0;i:0;i:1;i:0;}"],"easy-resource-permission":["switch_themes"],"reservations_child_price":["3"],"easy-resource-taxes":["a:0:{}"]},"thumbnail_size":"thumbnail","thumbnail_images":{"full":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169},"medium":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169},"large":{"url":"http:\/\/localhost\/vrqc\/wp-content\/uploads\/2015\/01\/Web_72dpi-1210_S2B_livingrm_c-300x169.jpg","width":300,"height":169}}}]

Not enough requests to make an API. I made a prototype once but don’t think I’ll ever get around to finish it.
Regards

You must be logged in to reply in this thread.

Suggestion
2 posts