As I've been exploring using Bedrock for creating RESTful APIs, one of the requirements for a well crafted API is to create appropriate URIs that make sense. I've read the phrase "you don't write RESTful APIs you DESIGN them" in more than one blog. This usually boils down to exposing the API in a logical and hierarchical manner. Apache's mod_rewrite is a versatile and useful tool for allowing you to create meaningful, well crafted endpoints that also work with Bedrock.
Showing posts with label json. Show all posts
Showing posts with label json. Show all posts
Saturday, April 4, 2015
Sunday, October 19, 2014
Pretty Print JSON objects
Added --pretty as an option to the <var> tag for pretty printing JSON objects. Changes pushed to git master.
<sink><null $header.content_type('application/json')>
<hash:foo red 1 blue 2 green 3>
</sink><var --pretty --json $foo>
<sink><null $header.content_type('application/json')>
<hash:foo red 1 blue 2 green 3>
</sink><var --pretty --json $foo>
...would yield
{
{
"green" : "3",
"blue" : "2",
"red" : "1"
}
Wednesday, January 1, 2014
Bedrock, jQuery and HTTP Status Codes
Using Bedrock to create AJAX components is trivial. Name your Bedrock file with a .jroc extension and return your result.
<var --json $result>
Can it get any easier? I just created a wiki page that shows how Bedrock handles exceptions for application/json files you serve up using Bedrock. I also describe how you can customize the HTTP status code that Bedrock returns to the browser.
http://twiki.openbedrock.net/twiki/bin/view/Bedrock/BedrockStatusCodes
<var --json $result>
Can it get any easier? I just created a wiki page that shows how Bedrock handles exceptions for application/json files you serve up using Bedrock. I also describe how you can customize the HTTP status code that Bedrock returns to the browser.
http://twiki.openbedrock.net/twiki/bin/view/Bedrock/BedrockStatusCodes
Subscribe to:
Posts (Atom)