Paste: basic http gets to fluiddb

Author: otoburb
Mode: factor
Date: Mon, 7 Dec 2009 22:07:44
Plain Text |
CONSTANT: sandbox "http://sandbox.fluidinfo.com"

: add-basic-auth-hdr ( response -- response ) "Basic dGVzdDp0ZXN0" "Authorization" set-header ;

: get-n-check-response ( response -- response ) [ http-request nip >string json> ] [ response>> nip ] recover ;

: get-user ( user -- response )
    sandbox "/users/" rot 3append <get-request> add-basic-auth-hdr get-n-check-response ;

: get-namespace ( user -- response )
    sandbox "/namespaces/" rot 3append
    "?returnNamespaces=True&returnTags=True&returnDescription=True" append
    <get-request> add-basic-auth-hdr get-n-check-response ; 

: get-tag-about ( tag -- response ) 
    sandbox "/tags/" rot 3append 
    "?returnDescription=True" append 
    <get-request> add-basic-auth-hdr get-n-check-response ; 

: get-tag-object ( user -- response ) ; 

New Annotation

Summary:
Author:
Mode:
Body: