From 0367703fdd967f727545ce75752de3899b9a7dac Mon Sep 17 00:00:00 2001 From: "V.Krishn" Date: Mon, 20 Jun 2016 07:51:59 +0530 Subject: formated docs --- docs/api-json.md | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/docs/api-json.md b/docs/api-json.md index e58d730..fc7f6d3 100644 --- a/docs/api-json.md +++ b/docs/api-json.md @@ -1,6 +1,6 @@ -'''JSONAPI''' implementations for aports packages. +# **JSONAPI** implementations for aports packages. Api is build around packages data and its relationships with other tables in database, @@ -9,10 +9,10 @@ using, simple one-to-one relationships (based on foreign-key/pid/id). Currently, any JOINS in database is being avoided and maybe used if needed. -Relationships -============== -Following relationships exists, emanating from a base package -* origin (original package to which the ''subpackage/named package'' belongs to) +## Relationships + +Following relationships exists, *emanating* from a base *package* +* origin (original package to which the **subpackage/named package** belongs to) * install_if * provides (what the package provides) * depends (what the named package depends on) @@ -20,43 +20,40 @@ Following relationships exists, emanating from a base package * flagged (if package is flagged, relationship to its data) -Base URL ------------ +## Base URL https://api.alpinelinux.org/ -packages ----------- -api uri: `/packages/...` +### packages +__api uri__: `/packages/...` Get packages list (paginated 50 items) * eg. `curl https://api.alpinelinux.org/packages | jq . | less` -searching ------------ -api uri: `/search//key1/value1/key2/value2` +### searching +__api uri__: `/search//key1/value1/key2/value2` + 1. where = packages|contents 2. keys = category|name|maintainer|flagged -api uri: `/search/packages/category/::/name/` +__api uri__: `/search/packages/category/::/name/` * Searches packages by categories and pkgName * Reserved keyword in categories - ''all'' * Wildcard for package name recogonized - '_' - * eg. Basic search `curl https://api.alpinelinux.org/search/packages/category/v3.4:all:x86/name/_bas_ | jq . | less` * eg. Advanced search +``` +curl -X POST https://api.alpinelinux.org/search/packages -d '{"name":"_bas_","category":"edge:main:x86"}' | jq . | less +``` -`curl -X POST https://api.alpinelinux.org/search/packages -d '{"name":"_bas_","category":"edge:main:x86"}' | jq . | less` - -categories ------------ -api uri: `/categories` +### categories +__api uri__: `/categories` * Get categories available. * Categories data are for branch:repo:arch (eg. edge:main:x86 ) @@ -64,21 +61,20 @@ api uri: `/categories` `/categories` -flagged packages ------------------ -1. api uri: `/flagged` +### flagged packages +__api uri__: `/flagged` * Get flagged data (paginated) (follow relationships link to get package data) * `/flagged/page/` - more items (older) -2. api uri: `/flagged/new` +__api uri__: `/flagged/new` * Get current flagged item * How to get the current package that got flagged -`new=$(curl api.alpinelinux.org/flagged/new | jq .data[].relationships.packages.links.self | sed -e 's/"//g'); curl $new | jq .data[].attributes.origin | uniq` - +``` +new=$(curl api.alpinelinux.org/flagged/new | jq .data[].relationships.packages.links.self | sed -e 's/"//g'); curl $new | jq .data[].attributes.origin | uniq +``` -maintainers ------------- +### maintainers * Get first page `/maintainer/names` * Get other pages -- cgit v1.2.3