Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rest table #75

Merged
merged 14 commits into from
Oct 2, 2024
24 changes: 24 additions & 0 deletions integration/rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
tile: "Rest API"
gkorland marked this conversation as resolved.
Show resolved Hide resolved
description: >
Rest API detailed doc
parent: "integration"
---

| Request Name | Request Endpoint | Request Method | Request Headers | Request Parameters | Body | Successful Response | Description|
| ------------- | ---------------- | -------------- | --------------- | ------------------ | ---- | ------------------- | ---------- |
| Login | [/api/auth/providers](http://localhost:3000/api/auth/providers) | GET | None | None | None | Status Code: 200<br>{<br>"credentials": {<br>"id": "credentials",<br>"name": "Credentials",<br>"type": "credentials",<br>"signinUrl": "http://localhost:3000/api/auth/signin/credentials",<br>"callbackUrl": "http://localhost:3000/api/auth/callback/credentials"<br>}<br>} | This request is used for user authentication. |
gkorland marked this conversation as resolved.
Show resolved Hide resolved
| Logout | [/api/auth/signout](http://localhost:3000/api/auth/signout) | POST | Content-Type: application/x-www-form-urlencoded | None | x-www-form-urlencoded:<br>1- Key: csrfToken – value: insert csrfToken<br>2- Key: callbackUrl – value: /login<br>3- Key: json - value: true | Status Code: 200<br>{<br>"url": "http://localhost:3000/api/auth/signout?csrf=true"<br>} | <br>This request is used to sign out users, ending their current authenticated session and logging them out of the system |
| Modify config role | [/api/graph?config=MAX_QUEUED_QUERIES&value=10](http://localhost:3000/api/graph?config=MAX_QUEUED_QUERIES&value=10) | POST | Authorization: Cookie | 1\. Key: config - Value: MAX_QUEUED_QUERIES (required)<br>2\. Key: value - Value: A number (required) | None | Status Code: 200<br>Response Body:<br>{ "config": "OK" } | This request is used to set a configuration value for MAX_QUEUED_QUERIES. It accepts a number as the value for the configuration and requires authorization via a cookie in the headers. |
| Get config role value | [/api/graph?config=MAX_QUEUED_QUERIES](http://localhost:3000/api/graph?config=MAX_QUEUED_QUERIES) | GET | Authorization: Cookie | 1\. Key: config - Value: MAX_QUEUED_QUERIES (required)<br>2\. Key: value - Value: A number (required) | None | Status code: 200<br>{"config": [ "MAX_QUEUED_QUERIES",25 ]} | This request is used to get a configuration value for MAX_QUEUED_QUERIES. It accepts a number as the value for the configuration and requires authorization via a cookie in the headers. |
| Create new user | [/api/user](http://localhost:3000/api/user) | POST | Authorization: Cookie | None | {<br>"username":"user",<br>"password":"password",<br>"role":"Read-Write"<br>} | Status Code: 201<br>{ "message": "User created"} | This request is used to create a new user with specified credentials. The required data, including the username, password, and role, is passed in the body of the request. Authorization is provided via a cookie in the headers. |
| Delete user | [/api/user](http://localhost:3000/api/user) | DELETE | Authorization: Cookie | None | {<br>"users":<br>[<br>{<br>"username":"userName",<br>"role":"Read-Write"<br>}<br>]<br>} | Status Code: 200<br>{<br>"message": "Users deleted"<br>} | This request is used to delete a user with specified credentials. The required data, including the username and role, is passed in the body of the request. Authorization is provided via a cookie in the headers. |
| Get All Users | [/api/user](http://localhost:3000/api/user) | GET | Authorization: Cookie | None | None | Status Code: 200<br>{<br>"result": [<br>{<br>"username": "default",<br>"role": "Admin",<br>"checked": false<br>}<br>]<br>} | This request retrieves a list of all users. Authorization is required via a cookie in the headers.<br><br><br><br><br><br><br> |
| Modify User Role | [/api/user/userName?role=Read-Only](http://localhost:3000/api/user/userName?role=Read-Only) | PATCH | Authorization: Cookie | 1\. Key: role - value: (e.g Admin, Read-Only, Read-Write)<br>2\. userName | None | Status Code: 200<br>{<br>"message": "Users created"<br>} | <br>This request updates the role of a specific user. The userName in the URL must be replaced with the actual username of the user whose role is being modified, and the role query parameter must be set to the desired role (e.g., Admin, Read-Only, Read-Write). Authorization is required via a cookie in the headers. |
| Create new Graph | [/api/graph/graphName?query=RETURN%201](http://localhost:3000/api/graph/graphName?query=RETURN%201) | GET | Authorization: Cookie | 1\. Graph name | None | Status Code: 200<br>{<br>"result": {<br>"metadata": [<br>"Cached execution: 0",<br>"Query internal execution time: 7.198178 milliseconds"<br>],<br>"data": [<br>{<br>"1": 1<br>}<br>]<br>}<br>} | This request creates a new graph with the specified name. Authorization is required via a cookie in the headers. The response includes metadata and data from the query execution. |
| Delete Graph | [/api/graph/graphName](http://localhost:3000/api/graph/graphName) | DELETE | Authorization: Cookie | 1\. Graph name | None | Status Code: 200<br>{<br>"message": "GraphName graph deleted"<br>} | This request deletes the graph with the specified name. Authorization is required via a cookie in the headers. The response confirms the deletion of the graph. |
| Get All Graphs | [/api/graph](http://localhost:3000/api/graph) | GET | Authorization: Cookie | None | None | Status Code: 200<br>{<br>"result": [ "graphName" ]<br>} | This request retrieves a list of all graphs. Authorization is required via a cookie in the headers. The response includes a list of graph names. |
| Run A Query | [/api/graph/graphName?query=yourQuery](http://localhost:3000/api/graph/graphName?query=yourQuery) | GET | Authorization: Cookie | 1\. Graph name<br>2\. Key: query - value: yourQuery | None | Status Code: 200<br>{<br>"result": {<br>"metadata": [<br>"Nodes created: 40",<br>"Relationships created: 20",<br>"Cached execution: 1",<br>"Query internal execution time: 0.201420 milliseconds"<br>],<br>"data": [ { queryData… } ]<br>} | This request runs a query on the specified graph. Authorization is required via a cookie in the headers. The response includes metadata about the query execution and the resulting data. |
| Duplicate A Graph | [/api/graph/destinationGraphName?sourceName=yourSourceName](http://localhost:3000/api/graph/destinationGraphName?sourceName=yourSourceName) | POST | Authorization: Cookie | 1\. destinationGraphName<br>2\. Key: sourceName - Value: yourSourceName | None | Status Code: 200<br>{ "success": "OK" } | This request duplicates a graph from a source to a destination. Authorization is required via a cookie in the headers. The response confirms the successful duplication of the graph. |
| Create New Schema | [/api/graph/schemaName?query=RETURN%201](http://localhost:3000/api/graph/schemaName?query=RETURN%201) | GET | Authorization: Cookie | 1\. schemaName | None | Status Code: 200<br>{<br>"result": {<br>"metadata": [<br>"Cached execution: 0",<br>"Query internal execution time: 0.153307 milliseconds"<br>],<br>"data": [<br>{<br>"1": 1<br>}<br>]<br>}<br>} | This request creates a new schema with the specified name. Authorization is required via a cookie in the headers. The response includes metadata and data from the query execution.<br> |
| Delete A Schema | [/api/graph/schemaName](http://localhost:3000/api/graph/schemaName) | DELETE | Authorization: Cookie | 1\. schemaName | None | Status Code: 200<br>{<br>"message": "schemaName graph deleted"<br>} | This request deletes the schema with the specified name. Authorization is required via a cookie in the headers. The response confirms the deletion of the schema. |
Loading