Get an Authentication Token
POST https://localhost:7007/auth/token
Get an authentication token which can be used to authenticate the REST API requests.
Request
Request Header
-
Accept:
application/json; charset=UTF-8 -
Content-Type:
application/json
Table: Request Body Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
username |
string | Name of the user | Yes |
password |
string | Password for the user | Yes |
createSession |
boolean | To determine if a session needs to be created | Optional. Set it to true if you want to run queries against the graph server (PGX). |
source |
string | A descriptive string identifying the client | Optional. Ensure to enter the source value without spaces (for example, “commandLine”, “JShell”, “PythonShell”, or APIClientTools). |
sessionId |
string | To reuse an existing session when connecting to the graph server | Optional. Set it to an existing session ID if you want to reuse that session. |
Sample Request Body
{
"username": "graphuser",
"password": "<password_for_graphuser>",
"createSession": true,
"source": "<source-value-for-pgx-session>",
"sessionId": "<session-id>"
}
Response
-
201 Created
-
Content-Type:
application/json
Sample Response Body
{
"access_token": "<token>"
"token_type": "bearer",
"expires_in": 3600
}
cURL Example
curl --location 'https://localhost:7007/auth/token' \
--header 'Content-Type: application/json' \
--data '{
"username": "graphuser",
"password": "<password_for_graphuser>",
"createSession": true,
"source": "commandLine",
"sessionId": "<session-id>"
}'