forked from bzed/go.debian.net
JSON API usage
Harsh Daftary edited this page Aug 21, 2016
·
2 revisions
- API HOST URL :
http://<domain>:<port>/rpc/json
- HTTP headers :
{'Content-type': 'application/json'}
- API method :
POST
-
add_url :
- Request JSON Body :
{'method': 'add_url', 'params': ['<URL including http or https>'], 'id': "jsonrpc"}
- Response Code: 200
- Response Body :
{'result' : '<shortened_key>', 'error' : false}
- Request JSON Body :
-
add_static_url :
- Request JSON Body :
{'method': 'add_static_url', 'params': ['<URL>', '<KEYWORD'], 'id': "jsonrpc"}
- Response Code: 200
- Response Body :
{'result' : '<shortened_Key>', 'error' : false}
- Request JSON Body :
-
get_url :
- Request JSON Body :
{'method': 'get_url', 'params': ['<shortened_key>'], 'id': "jsonrpc"}
- Response Code: 200
- Response Body :
{'result' : '<URL>', 'error' : false}
- Request JSON Body :
- Error description will be given in error field of JSON Response with response code other than 200.
- Static URL is very similar to add_url with main difference is that instead of random key generated by add_url here key is pre-determined.
- sqlalchemy.Integer is not supported with postgres hence PGBigInteger or BIGINT is used.
- update_url function will update static_url mapping of static_id and mapped URL.
- Change production_mode = False to True in godebian/config.py to use Production Level config file.
- Convert a mapping object or a sequence of two-element tuples to a “percent-encoded” string, suitable to pass to urlopen() above as the optional data argument.
- The IP class allows a comfortable parsing and handling for most notations in use for IPv4 and IPv6 addresses and networks.
- It was greatly inspired by RIPE's Perl module NET::IP's interface but doesn't share the implementation.
- It doesn't share non-CIDR netmasks, so funky stuff like a netmask of 0xffffff0f can't be done here.