Get a Graph - Cognigy Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get a Graph
Example Requests
cURL
curl --request GET \
--url https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/graph \
--header 'X-API-Key: <api-key>'
Python
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/graph"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/graph', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/graph",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/graph"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Response Status Codes
- 200: Project graph retrieved successfully.
- 400: Bad Request. Validation failed. Missing payload.
- 401: Unauthorized. Invalid API Key.
- 402: Payment Required. Validation failed. Missing payload.
- 403: Forbidden. Access denied.
- 404: Not Found. Resource could not be located.
- 405: Method Not Allowed. The request method is not supported.
- 409: Conflict. The request conflicts with the current state of the resource.
- 413: Payload Too Large. The request is larger than the server is willing to process.
- 500: Internal Server Error. An error occurred on the server.
- 501: Not Implemented. The server does not support the functionality required to fulfill the request.
- 502: Bad Gateway. The server received an invalid response from the upstream server.
- 503: Service Unavailable. The server is currently unavailable to handle the request.
- 504: Gateway Timeout. The server did not receive a timely response from the upstream server.
Authorizations
- APIKey: Required in header as
X-API-Key.