====== Differences ====== This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
api2:knowledge_structure:knowledge_node [2017/10/07 14:46] 127.0.0.1 external edit |
api2:knowledge_structure:knowledge_node [2018/07/23 09:41] (current) maries |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | The content’s structure is scattered into Knowledge Nodes. Knowledge Nodes are the second objects to instantiate while setting up your content on our API.\\ | ||
| + | |||
| + | {{:api2:knowledge_structure:graph.jpg?400|graph}} | ||
| + | |||
| + | ===Object resources=== | ||
| + | |||
| + | ^ Property ^ Type ^ Description ^ | ||
| + | | id | Integer | identifier for the database of Domoscio's API | | ||
| + | | knowledge_graph_id | Integer | The knowledge graph this knowledge node belongs to | | ||
| + | | name | String | Custom data | | ||
| + | | uid | String | The ID of this knowledge node in your Database | | ||
| + | | created_at | DateTime | Date of creation of the object | | ||
| + | | updated_at | DateTime | Last time the object has been modified | | ||
| + | | difficulty | Float | Our estimation of how difficult this concept is to memorize | | ||
| + | |||
| + | ===Create (POST)=== | ||
| + | |||
| + | ^ Method | POST | | ||
| + | ^ URL | /knowledge_nodes | | ||
| + | |||
| + | ==Parameters (*Requiered parameters)== | ||
| + | |||
| + | ^ Property ^ Type ^ Description ^ | ||
| + | | knowledge_graph_id* | Integer | The knowledge graph this knowledge node belongs to | | ||
| + | | name | String | Custom data | | ||
| + | | uid* | String | The ID of this knowledge node in your Database. Useful if you cannot store the ID returned by the API | | ||
| + | |||
| + | ==Send the request (JSON input example)== | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | knowledge_graph_id: 856, | ||
| + | name: "Financial asset", | ||
| + | uid: "fin01" | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ==Get the response (JSON output example)== | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "name": "Financial asset", | ||
| + | "knowledge_graph_id": 856, | ||
| + | "id": 3170, | ||
| + | "created_at": "2017-11-22T15:24:15.098Z", | ||
| + | "updated_at": "2017-11-22T15:24:15.098Z", | ||
| + | "uid": "fin1", | ||
| + | "difficulty": 1 | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ===Fetch (GET)=== | ||
| + | |||
| + | ^ Method | GET | | ||
| + | ^ URL | /knowledge_nodes/{knowledge_node_id} | | ||
| + | |||
| + | If no knowledge_node_id is provided you can use the following parameters to filter only some knowledge nodes.\\ | ||
| + | |||
| + | ^ Property ^ Type ^ Description ^ | ||
| + | | knowledge_graph_id | Integer | The knowledge graph this knowledge node belongs to | | ||
| + | | uid | String | The ID of this knowledge node in your Database. Useful if you cannot store the ID returned by the API | | ||
| + | |||
| + | ==Get the response (JSON output example)== | ||
| + | |||
| + | **With ID provided**\\ | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "id": 3170, | ||
| + | "knowledge_graph_id": 856, | ||
| + | "created_at": "2017-11-22T15:24:15.098Z", | ||
| + | "updated_at": "2017-11-22T15:24:15.098Z", | ||
| + | "uid": "fin02", | ||
| + | "name": "Financial asset2", | ||
| + | "difficulty": 1 | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | |||
| + | **Without ID provided**\\ | ||
| + | <code> | ||
| + | [ | ||
| + | { | ||
| + | "id": 2714, | ||
| + | "knowledge_graph_id": 782, | ||
| + | "name": "1_1", | ||
| + | "uid": null, | ||
| + | "created_at": "2017-09-20T14:35:38.663Z", | ||
| + | "updated_at": "2017-11-20T09:53:10.116Z", | ||
| + | "difficulty": 1.2 | ||
| + | }, | ||
| + | { | ||
| + | "id": 3169, | ||
| + | "knowledge_graph_id": 856, | ||
| + | "name": "Financial asset", | ||
| + | "uid": "fin01", | ||
| + | "created_at": "2017-11-22T15:13:34.162Z", | ||
| + | "updated_at": "2017-11-22T15:13:34.162Z", | ||
| + | "difficulty": 1 | ||
| + | }, | ||
| + | { | ||
| + | "id": 3170, | ||
| + | "knowledge_graph_id": 856, | ||
| + | "name": "Financial asset2", | ||
| + | "uid": "fin02", | ||
| + | "created_at": "2017-11-22T15:24:15.098Z", | ||
| + | "updated_at": "2017-11-22T15:24:15.098Z", | ||
| + | "difficulty": 1 | ||
| + | } | ||
| + | ] | ||
| + | </code> | ||
| + | |||
| + | ===Fetch all Knowledge Nodes by Knowledge Graph=== | ||
| + | |||
| + | You can get all Knowledge Nodes relative to a given Knowledge Graph. | ||
| + | |||
| + | ^ Method | GET | | ||
| + | ^ URL | /v2/knowledge_graphs/{knowledge_graph_id}/knowledge_nodes | | ||
| + | |||
| + | ===EDIT (PUT)=== | ||
| + | |||
| + | ^ Method | PUT | | ||
| + | ^ URL | /v2/knowledge_nodes/{knowledge_node_id} | | ||
| + | |||
| + | ==Editable parameters== | ||
| + | |||
| + | ^ Property ^ Type ^ Description/expected values | | ||
| + | | name | String | Custom data (<255 chars) | | ||
| + | | uid | String | Custom data (<255 chars) | | ||
| + | |||
| + | ==Send the request (JSON input example)== | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | name: "No more Financial asset", | ||
| + | uid: "nofin2" | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ==Get the response (JSON output example)== | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "id": 3170, | ||
| + | "knowledge_graph_id": 856, | ||
| + | "created_at": "2017-11-22T15:24:15.098Z", | ||
| + | "updated_at": "2017-11-22T15:42:56.878Z", | ||
| + | "name": "No more Financial asset", | ||
| + | "uid": "nofin2", | ||
| + | "difficulty": 1 | ||
| + | } | ||
| + | </code> | ||
| + | |||