Integrations
Get a PostgreSQL connection
Returns the settings of a PostgreSQL connection. The password is never returned.
GET
/
api
/
v1
/
integrations
/
connections
/
{id}
/
postgres
Get a PostgreSQL connection
curl --request GET \
--url https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres \
--header 'Authorization: <api-key>'import requests
url = "https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres', 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.costgraph.ai/api/v1/integrations/connections/{id}/postgres",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"connection": {
"connection_id": "<string>",
"connection_modes": [
"cost"
],
"created_at": "<string>",
"display_name": "<string>",
"has_metrics_source": true,
"history": {
"days_remaining": 123,
"window_days": 123,
"loaded_through": "2023-12-25"
},
"hosted": true,
"id": "<string>",
"in_jobs": 123,
"ingest_mode": "pull",
"last_sync_error": "<string>",
"last_synced_at": "<string>",
"needs_service_token": true,
"provider": "<string>",
"provider_account_id": "<string>",
"recommendations_checked_at": "<string>",
"recommendations_status": "<string>",
"sandbox_provider": "<string>",
"status": "<string>",
"tenant_id": "<string>",
"trialing_jobs": 123,
"updated_at": "<string>",
"warnings": [
"<string>"
]
},
"database": "<string>",
"host": "<string>",
"instance_id": "<string>",
"port": 123,
"sslmode": "<string>",
"user": "<string>",
"warnings": [
"<string>"
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Was this page helpful?
⌘I
Get a PostgreSQL connection
curl --request GET \
--url https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres \
--header 'Authorization: <api-key>'import requests
url = "https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres', 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.costgraph.ai/api/v1/integrations/connections/{id}/postgres",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/connections/{id}/postgres")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"connection": {
"connection_id": "<string>",
"connection_modes": [
"cost"
],
"created_at": "<string>",
"display_name": "<string>",
"has_metrics_source": true,
"history": {
"days_remaining": 123,
"window_days": 123,
"loaded_through": "2023-12-25"
},
"hosted": true,
"id": "<string>",
"in_jobs": 123,
"ingest_mode": "pull",
"last_sync_error": "<string>",
"last_synced_at": "<string>",
"needs_service_token": true,
"provider": "<string>",
"provider_account_id": "<string>",
"recommendations_checked_at": "<string>",
"recommendations_status": "<string>",
"sandbox_provider": "<string>",
"status": "<string>",
"tenant_id": "<string>",
"trialing_jobs": 123,
"updated_at": "<string>",
"warnings": [
"<string>"
]
},
"database": "<string>",
"host": "<string>",
"instance_id": "<string>",
"port": 123,
"sslmode": "<string>",
"user": "<string>",
"warnings": [
"<string>"
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}