-
Notifications
You must be signed in to change notification settings - Fork 23
Aura Query API tutorial #647
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
Changes from all commits
6e89dd9
5a00bb0
6d336a4
99c7865
82620b1
2583b04
da6234a
d651d96
2623cd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
[[aura-query-api-tutorial]] | ||
= Aura Query API | ||
:description: This page describes how to create a node using Query API and an Aura instance. | ||
|
||
== Introduction | ||
|
||
The Query API enables interaction with an Aura database using Cypher via HTTPS. | ||
|
||
This tutorial guides you through the process of sending Cypher queries to an Aura instance using the Query API. | ||
|
||
For more information, see the link:https://neo4j.com/docs/query-api/current/[Query API documentation] but note that: | ||
|
||
* For Aura instances, the host follows the format `<databaseID>.databases.neo4j.io` | ||
|
||
* The Query API documentation mainly refers to self-managed instances that use port `7474`, whereas Aura supports HTTPS only, which defaults to port `443` | ||
|
||
* As HTTPS implies port `443` in the request, you do not need to include the port in the URL. | ||
|
||
== API endpoint | ||
|
||
To send Cypher queries to an Aura instance, make a `POST` request to the following API endpoint: | ||
|
||
[source, header] | ||
---- | ||
https://<instanceID>.databases.neo4j.io/db/<databaseName>/query/v2 | ||
---- | ||
|
||
*Parameters* | ||
|
||
`<databaseID>` = The unique ID of your Aura database (e.g. e011c23c). | ||
|
||
`<databaseName>` = The target database (use `neo4j` for the default database). | ||
|
||
*Example Endpoint:* | ||
|
||
[source, header] | ||
---- | ||
https://537dfda7.databases.neo4j.io/db/neo4j/query/v2 | ||
---- | ||
|
||
aura recently introduced custom endpoint... i.e. a alias that points to #####.databases.neo4j.io | ||
|
||
=== Custom endpoints | ||
|
||
You can send Cypher queries to the Query API using a custom endpoint just as you would with the standard one. | ||
|
||
https://<customerEndpoint>.endpoints.neo4j.io:443/db/neo4j/query/v2 | ||
|
||
`<customerEndpoint>` = The target endpoint | ||
|
||
https://technology3ndpoint-dev-eng.endpoints.neo4j.io:443/db/neo4j/query/v2 | ||
|
||
== Queries using cURL | ||
|
||
You can interact with the Query API using cURL, in your command-line terminal. | ||
This provides a simple way to communicate with the database without using a language library. | ||
Ensure that cURL is installed in your system before proceeding. | ||
|
||
== Example: create a node | ||
|
||
This example demonstrates how to create a Person node in an Aura instance, using cURL: | ||
|
||
[source, shell] | ||
---- | ||
curl -vvv -X POST \ # <1> | ||
-H "Authorization: Basic bmVvNGo1MlFidnE4TEFrRnZwXzdjT1NRM2F1NTJXVVRpTXotUERXQTU1NTdmRWFKdw==" \ # <2> | ||
-H "Content-Type: application/json" \ # <3> | ||
-d '{ "statement": "CREATE (n:Person {name: \'Alice\'\}) RETURN n" }' \ # <4> | ||
https://537dfda7.databases.neo4j.io/db/neo4j/query/v2 # <5> | ||
---- | ||
|
||
=== Explanation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend using callouts directly in the example ( For an example, see https://github.com/neo4j/docs-drivers/blob/dev/python-manual/modules/ROOT/pages/query-simple.adoc?plain=1#L15 |
||
|
||
<1> `-X POST` Specifies that the request is a POST request. | ||
|
||
<2> `-H "Authorization: Basic <base64_encoded_credentials>":` Replace <base64_encoded_credentials> with your Base64-encoded Neo4j credentials (neo4j:your-password). | ||
Learn more about link:https://neo4j.com/docs/query-api/current/authentication-authorization/#_basic_authentication[basic authentication]. | ||
|
||
<3> `-H "Content-Type: application/json"` Specifies that the request body is in JSON format. | ||
|
||
<4> `-d '{ "statement": "CREATE (n:Person) RETURN n" }'` Contains the Cypher query to create a Person node. | ||
|
||
Note: The `\` backslashes allow multi-line commands in the terminal. | ||
|
||
== Tip | ||
|
||
You can also use tools like Postman to format and send requests more easily. | ||
|
||
== Next Steps | ||
|
||
Try executing different Cypher queries to retrieve, update, or delete nodes in your Aura database. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the custom endpoint for aura info
Then we don't need anything from curl queries onwards and examples - that can go in Query API docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use a tabbed example in the Query API docs