summaryrefslogtreecommitdiff
path: root/posts/2010-06-10-moosex-net-api-update.md
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-08-10 14:33:04 -0700
committerFranck Cuny <franck.cuny@gmail.com>2016-08-10 20:17:56 -0700
commit8d7d02f42c3947f756c18cb4d37d9d97fbd0d27d (patch)
treea6cecddaaea7e87d901a6c28bebe3a531438f24b /posts/2010-06-10-moosex-net-api-update.md
parentMerge branch 'convert-to-org' (diff)
downloadlumberjaph-8d7d02f42c3947f756c18cb4d37d9d97fbd0d27d.tar.gz
convert back to md
Diffstat (limited to '')
-rw-r--r--posts/2010-06-10-moosex-net-api-update.md (renamed from posts/2010-06-10-moosex-net-api-update.org)95
1 files changed, 36 insertions, 59 deletions
diff --git a/posts/2010-06-10-moosex-net-api-update.org b/posts/2010-06-10-moosex-net-api-update.md
index f130447..c6643c0 100644
--- a/posts/2010-06-10-moosex-net-api-update.org
+++ b/posts/2010-06-10-moosex-net-api-update.md
@@ -1,8 +1,6 @@
-[[http://git.lumberjaph.net/p5-moosex-net-api.git/][MooseX::Net::API]]
-is a module to help writing clients for RESTful (and even non-RESTful)
-WebServices:
+[MooseX::Net::API](http://git.lumberjaph.net/p5-moosex-net-api.git/) is a module to help writing clients for RESTful (and even non-RESTful) WebServices:
-#+BEGIN_SRC perl
+``` perl
package my::api;
use MooseX::Net::API;
@@ -18,17 +16,13 @@ WebServices:
params => [qw/country/],
expected => [qw/200 404/],
);
-#+END_SRC
+```
-We've been using this module at work for the last few months on various
-internal APIs, and I'm pretty pleased with the result so far.
+We've been using this module at work for the last few months on various internal APIs, and I'm pretty pleased with the result so far.
-Lately I've started to rework the core. I've tried to split most of the
-functionalities into roles, and rework the code that generates the
-various methods. I've also added methods to access miscellaneous
-information :
+Lately I've started to rework the core. I've tried to split most of the functionalities into roles, and rework the code that generates the various methods. I've also added methods to access miscellaneous information :
-#+BEGIN_SRC perl
+``` perl
my $client = my::api->new;
# to get a list of API methods
@@ -46,30 +40,25 @@ information :
path: /users/:country
arguments: country
expected: 200, 404
-#+END_SRC
-
-It's not yet complete, but a new version will be available soon on CPAN.
-Here is a list of some more features I plan to add quickly:
-
-- better internal API
-- better authorization support (OAuth!)
-- add more methods to provide better introspection
-- better unserialization
-- more tests and better documentation
-- generate POD via a PODWeaver plugin ?
-- plugins ?
-- renaming ? (not sure it really fits in the MooseX:: namespace)
-
-** http-console
-
-I've also started
-[[http://git.lumberjaph.net/p5-net-http-console.git/][Net::HTTP::Console]].
-It's inspired by
-[[http://github.com/cloudhead/http-console][http-console]]. It relies on
-MX::Net::API, and can use any libraries written with MX::Net::API, as
-well as any *raw* RESTful API. As an example, let's use it on twitter.
-
-#+BEGIN_EXAMPLE
+```
+
+It's not yet complete, but a new version will be available soon on CPAN. Here is a list of some more features I plan to add quickly:
+
+- better internal API
+- better authorization support (OAuth!)
+- add more methods to provide better introspection
+- better unserialization
+- more tests and better documentation
+- generate POD via a PODWeaver plugin ?
+- plugins ?
+- renaming ? (not sure it really fits in the MooseX:: namespace)
+
+http-console
+------------
+
+I've also started [Net::<HTTP::Console>](http://git.lumberjaph.net/p5-net-http-console.git/). It's inspired by [http-console](http://github.com/cloudhead/http-console). It relies on MX::Net::API, and can use any libraries written with MX::Net::API, as well as any **raw** RESTful API. As an example, let's use it on twitter.
+
+``` example
% http-console --url http://api.twitter.com --format json
http://127.0.0.1:5984> GET /1/statuses/public_timeline
@@ -90,14 +79,13 @@ well as any *raw* RESTful API. As an example, let's use it on twitter.
x-transaction: 1275924432-94882-31146
x-ratelimit-reset: 1275925258
...
-#+END_EXAMPLE
+```
-You can call any method from the twitter API (at the exception of the
-ones that require authentication: it's not supported yet).
+You can call any method from the twitter API (at the exception of the ones that require authentication: it's not supported yet).
You can also use it with any library that uses MX::Net::API:
-#+BEGIN_EXAMPLE
+``` example
% http-console --lib Net::Backtweet
http://api.backtweet.com> help command
@@ -116,36 +104,25 @@ You can also use it with any library that uses MX::Net::API:
{
"tweetcount" : 388
}
-#+END_EXAMPLE
+```
-Arguments to the methods are serialized in JSON format. Not sure if it's
-the best idea I will see if it needs improvement while using it. You can
-also perform POST and PUT with content.
+Arguments to the methods are serialized in JSON format. Not sure if it's the best idea I will see if it needs improvement while using it. You can also perform POST and PUT with content.
-#+BEGIN_EXAMPLE
+``` example
http://localhost:5984> POST /test_rtgi_fetcher {"foo":"bar"}
{
"ok" : true,
"rev" : "1-fe67006eb0e02e5f0057b5b2a6672391",
"id" : "fe3175615a34eb28153479307c000f26"
}
-#+END_EXAMPLE
+```
-It's far from being complete at the moment, but I will extend it
-quickly. Right now, you can define global headers, and get help for all
-methods in your MX::Net::API library. Authentication is on top of my
-priority list, as is alias creation, so instead of doing (on a
-non-moosex::net::api lib): =GET /users/= you will do:
+It's far from being complete at the moment, but I will extend it quickly. Right now, you can define global headers, and get help for all methods in your MX::Net::API library. Authentication is on top of my priority list, as is alias creation, so instead of doing (on a non-moosex::net::api lib): `GET /users/` you will do:
-#+BEGIN_QUOTE
- alias users/:country as users
-#+END_QUOTE
+> alias users/:country as users
then:
-#+BEGIN_QUOTE
- users {"country":"france"}
-#+END_QUOTE
+> users {"country":"france"}
-(and yes, I've switched from wordpress to
-[[http://github.com/perigrin/blawd][blawd]]).
+(and yes, I've switched from wordpress to [blawd](http://github.com/perigrin/blawd)).