|
| 1 | +## Introspection |
| 2 | + |
| 3 | +### predicates |
| 4 | + |
| 5 | +API endpoint: `https://api.grids.by/v1/predicates.json` |
| 6 | + |
| 7 | +Parameters: |
| 8 | + |
| 9 | +* `graph` [required, Read-access required] |
| 10 | + |
| 11 | +Example query: `https://api.grids.by/v1/predicates.json?graph=http%3A%2F%2Fgrids.by%2Fgraphs%2Fweb-apis` |
| 12 | + |
| 13 | +OAuth signature is required. |
| 14 | + |
| 15 | +Returns list of RDF-predicates, which are present in graph. |
| 16 | + |
| 17 | +Valid responses are: |
| 18 | + |
| 19 | +* 200 OK, `Content-type: application/json`, body is an array of URIs |
| 20 | +* 4xx — various errors |
| 21 | + |
| 22 | +### values |
| 23 | + |
| 24 | +API endpoint: `https://api.grids.by/v1/values.json` |
| 25 | + |
| 26 | +Parameters: |
| 27 | + |
| 28 | +* `graph` [required, Read-access required] |
| 29 | +* `predicate` [required] |
| 30 | + |
| 31 | +Example query: `https://api.grids.by/v1/value.json?graph=http%3A%2F%2Fgrids.by%2Fgraphs%2Fweb-apis&predicate=http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label` |
| 32 | + |
| 33 | +OAuth signature is required. |
| 34 | + |
| 35 | +Returns list of values, which correspond to the predicate given, in this graph. |
| 36 | + |
| 37 | +Valid responses are: |
| 38 | + |
| 39 | +* 200 OK, `Content-type: application/json`, body is an array of strings |
| 40 | +* 4xx — various errors |
| 41 | + |
| 42 | +## Read data |
| 43 | + |
| 44 | +### list |
| 45 | + |
| 46 | +API endpoint: `https://api.grids.by/v1/list.json` |
| 47 | + |
| 48 | +Parameters: |
| 49 | + |
| 50 | +* `graph` [required, Read-access required] |
| 51 | +* you can use any number of `filters[n][predicate]=value` parameters to filter dataset (don't forget to "urlencode" them) |
| 52 | + |
| 53 | +Example query: `https://api.grids.by/v1/list.json?graph=http%3A%2F%2Fgrids.by%2Fgraphs%2Fweb-apis&filters%5B0%5D%5Bschema%3Aname%5D=BitBucket&filters%5B1%5D%5Bschema%3Aname%5D=GitHub` |
| 54 | + |
| 55 | +If you're planning on passing a lot of parameters it's recommended to use POST and provide the parameters in the request body as a JSON (make sure to provide proper `Content-type` header): |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "graph":"http://grids.by/graphs/web-apis", |
| 60 | + "filters":[ |
| 61 | + {"schema:name":"BitBucket"}, |
| 62 | + {"schema:name":"123ContactForm"}, |
| 63 | + ] |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +OAuth signature is required. |
| 68 | + |
| 69 | +Returns list of RDF-subjects, which have matching predicate/value pairs. |
| 70 | + |
| 71 | +Valid responses are: |
| 72 | + |
| 73 | +* 200 OK, `Content-type: application/json`, body is an array of URIs, which are "subjects" of the items |
| 74 | +* 4xx — various errors |
| 75 | + |
| 76 | +### get |
| 77 | + |
| 78 | +API endpoint: `https://api.grids.by/v1/get.json` |
| 79 | + |
| 80 | +Parameters: |
| 81 | + |
| 82 | +* `graph` [required, Read-access required] |
| 83 | +* `subject` [required] |
| 84 | +* `deeper` [optional, default=0; can be "0" or "1"] |
| 85 | + |
| 86 | +Example query: `https://api.grids.by/v1/get.json?graph=http://grids.by/graphs/web-apis&subject=http://apis.io/Bing` |
| 87 | + |
| 88 | +If you're planning on passing a lot of parameters it's recommended to use POST and provide the parameters in the request body as a JSON: |
| 89 | +```json |
| 90 | +{ |
| 91 | + "graph":"http://grids.by/graphs/web-apis", |
| 92 | + "subject":"http://apis.io/Bing", |
| 93 | + "deeper":0 |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +OAuth signature is required |
| 98 | + |
| 99 | +Returns JSON-LD structure, which corresponds to requested graph/subject pair. Will give 1 additional level of depth, if `deeper=1` parameter is given. |
| 100 | + |
| 101 | +Valid responses are: |
| 102 | + |
| 103 | +* 200 OK, `Content-type: application/ld+json` |
| 104 | +* 4xx — various errors |
| 105 | + |
| 106 | +## Write data |
| 107 | + |
| 108 | +### append |
| 109 | + |
| 110 | +API endpoint: `https://api.grids.by/v1/append` |
| 111 | + |
| 112 | +Parameters: |
| 113 | + |
| 114 | +* `graph` [required, Append- or Write-access is required] |
| 115 | + |
| 116 | +Example query: `http://api.grids.by/v1/append?graph=http%3A%2F%2Fgrids.by%2Fgraphs%2Fmovies` |
| 117 | + |
| 118 | +This should be a POST request, POST body should contain the triples to import in Turtle or JSON-LD format with the appropriate headers `text/turtle` or `application/ld+json` respectively. |
| 119 | + |
| 120 | +OAuth signature is required |
| 121 | + |
| 122 | +Triples would be imported into requested graph (if application has enough permissions). |
| 123 | + |
| 124 | +Check HTTP status code. Valid responses are: |
| 125 | + |
| 126 | +* 200 OK, Content-type: plain/text, body has number of triples which were imported |
| 127 | +* 202 Accepted (we got the data, put it in queue, but it is not imported yet) |
| 128 | +* 400 Bad Request (required parameters are not set, or data is not valid syntactically) |
| 129 | +* 422 Unprocessable Entity (we can't import data you provided, for some reason. syntax is ok, but there is some semantic problem) |
| 130 | +* 4xx — various other errors |
| 131 | + |
| 132 | +## Other |
| 133 | + |
| 134 | +### SPARQL |
| 135 | + |
| 136 | +API endpoint: `https://api.grids.by/v1/sparql` |
| 137 | + |
| 138 | +Parameters: |
| 139 | + |
| 140 | +* `default-graph-uri` [at least one required, **both** Read- and Write-access is required] |
| 141 | +* see [SPARQL 1.1 Protocol](http://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/) for further details |
| 142 | + |
| 143 | +OAuth signature is required |
0 commit comments