| | 1 | = CKAN Restful API: Future Development = |
| | 2 | |
| | 3 | Suffers from a number of [http://www.prescod.net/rest/mistakes/ RESTful no-no's].... |
| | 4 | |
| | 5 | == Design Questions == |
| | 6 | |
| | 7 | * What are the resources, and where are they located? |
| | 8 | * What data formats are in use? |
| | 9 | * What methods are supported at each resource location? |
| | 10 | * What status codes could be returned? |
| | 11 | |
| | 12 | == Current Development Issues == |
| | 13 | |
| | 14 | * How does a machine client acquire and select from the package license options? |
| | 15 | * Can the above POST parameter data types be specified more formally? |
| | 16 | |
| | 17 | ---- |
| | 18 | |
| | 19 | = Original API Proposal = |
| | 20 | |
| | 21 | == Resources == |
| | 22 | |
| | 23 | || '''Resource''' || '''Location''' || |
| | 24 | || All Licenses|| !http://ckan.net/api/rest/licenses || |
| | 25 | || Licence || !http://ckan.net/api/rest/license/:id || |
| | 26 | || All Packages || !http://ckan.net/api/rest/packages || |
| | 27 | || Package || !http://ckan.net/api/rest/package/:id || |
| | 28 | || All Tags || !http://ckan.net/api/rest/tags || |
| | 29 | || Tag || !http://ckan.net/api/rest/tag/:id || |
| | 30 | |
| | 31 | == Data Formats == |
| | 32 | |
| | 33 | ''Todo: Decide how to identify objects (name, database ID, UUID), then fixup these data formats. Currently assumed to use the value of the object name attribute as the object's resource identifier.'' |
| | 34 | |
| | 35 | ==== Database ID Format ==== |
| | 36 | |
| | 37 | {{{ |
| | 38 | An integer. |
| | 39 | }}} |
| | 40 | |
| | 41 | ==== UUID Format ==== |
| | 42 | |
| | 43 | {{{ |
| | 44 | ? |
| | 45 | }}} |
| | 46 | |
| | 47 | |
| | 48 | ==== Name ID Format ==== |
| | 49 | |
| | 50 | {{{ |
| | 51 | The value of the object's name attribute. |
| | 52 | }}} |
| | 53 | |
| | 54 | |
| | 55 | ==== License List Format ==== |
| | 56 | |
| | 57 | {{{ |
| | 58 | { |
| | 59 | "licence-list": [ |
| | 60 | { |
| | 61 | "id": "BSD" |
| | 62 | |
| | 63 | },{ |
| | 64 | "id": "MIT" |
| | 65 | } |
| | 66 | ] |
| | 67 | } |
| | 68 | }}} |
| | 69 | |
| | 70 | ==== License Format ==== |
| | 71 | |
| | 72 | {{{ |
| | 73 | { |
| | 74 | "licence": { |
| | 75 | "name": "BSD" |
| | 76 | } |
| | 77 | } |
| | 78 | }}} |
| | 79 | |
| | 80 | ==== Package List Format ==== |
| | 81 | |
| | 82 | {{{ |
| | 83 | { |
| | 84 | "package-list": [ |
| | 85 | { |
| | 86 | "id": "dataset-1" |
| | 87 | |
| | 88 | },{ |
| | 89 | "id": "dataset-2" |
| | 90 | } |
| | 91 | ] |
| | 92 | } |
| | 93 | }}} |
| | 94 | |
| | 95 | ==== Package Format ==== |
| | 96 | |
| | 97 | {{{ |
| | 98 | { |
| | 99 | "package": { |
| | 100 | "name": "dataset-1", |
| | 101 | "title": "My Title", |
| | 102 | "url": "http://mylocation", |
| | 103 | "download_url": "http://mydownloadlocation", |
| | 104 | "licences": [5,7], |
| | 105 | "tags": "this that other", |
| | 106 | "notes": "Some notes." |
| | 107 | } |
| | 108 | } |
| | 109 | }}} |
| | 110 | |
| | 111 | ==== Tag List Format ==== |
| | 112 | |
| | 113 | {{{ |
| | 114 | { |
| | 115 | "tag-list": [ |
| | 116 | { |
| | 117 | "id": "this" |
| | 118 | |
| | 119 | },{ |
| | 120 | "id": "that" |
| | 121 | } |
| | 122 | ] |
| | 123 | } |
| | 124 | }}} |
| | 125 | |
| | 126 | ==== Tag Format ==== |
| | 127 | |
| | 128 | {{{ |
| | 129 | { |
| | 130 | "tag": { |
| | 131 | "name": "this" |
| | 132 | } |
| | 133 | } |
| | 134 | }}} |
| | 135 | |
| | 136 | == Methods, Formats, and Status Codes == |
| | 137 | |
| | 138 | || '''Resource''' || '''Method''' || '''Format''' || '''Status Codes''' || |
| | 139 | || All Licenses || GET || License List Format || 200, 301 || |
| | 140 | || All Licenses || POST || License Format || 201, 400 || |
| | 141 | || License || GET || License Format || 200, 301, 410 || |
| | 142 | || License || PUT || License Format || 200, 301, 400, 410 || |
| | 143 | || License || DELETE || N/A || 200, 204 || |
| | 144 | || All Packages || GET || Package List Format || 200, 301 || |
| | 145 | || All Packages || POST || Package Format || 201, 400 || |
| | 146 | || Package || GET || Package Format || 200, 301, 410 || |
| | 147 | || Package || PUT || Package Format || 200, 301, 400, 410 || |
| | 148 | || Package || DELETE || N/A || 200, 204 || |
| | 149 | || All Tags || GET || Tag List Format || 200, 301 || |
| | 150 | || All Tags || POST || Tag Format || 201, 400 || |
| | 151 | || Tags || GET || Tag Format || 200, 301, 410 || |
| | 152 | || Tags || PUT || Tag Format || 200, 301, 400, 410 || |
| | 153 | || Tags || DELETE || N/A || 200, 204 || |
| | 154 | |