Create Reconnect Invitation
curl --request POST \
--url https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allowedEmails": [
"jsmith@example.com"
],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": false
}
'import requests
url = "https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}"
payload = {
"allowedEmails": ["jsmith@example.com"],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedEmails: ['jsmith@example.com'],
expiresInSeconds: 61,
maxUses: 2,
sendEmail: false
})
};
fetch('https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}', 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://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'allowedEmails' => [
'jsmith@example.com'
],
'expiresInSeconds' => 61,
'maxUses' => 2,
'sendEmail' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}"
payload := strings.NewReader("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"invitationType": "<string>",
"status": "<string>",
"invitationUrl": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowedEmails": [
"jsmith@example.com"
],
"expiresAt": "2023-11-07T05:31:56Z",
"maxUses": 123,
"useCount": 123,
"created": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [
"ELECTRICITY"
],
"country": "AF",
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
},
"createdConnections": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"datasourceName": "<string>",
"status": "<string>",
"created": "2023-11-07T05:31:56Z"
}
]
}Invitations
Create Reconnect Invitation
Create an invitation that lets a contributor update credentials on an existing utility account connection. The response includes an invitationUrl to send to the contributor.
POST
/
invitation
/
connection
/
{connection_id}
Create Reconnect Invitation
curl --request POST \
--url https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allowedEmails": [
"jsmith@example.com"
],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": false
}
'import requests
url = "https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}"
payload = {
"allowedEmails": ["jsmith@example.com"],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedEmails: ['jsmith@example.com'],
expiresInSeconds: 61,
maxUses: 2,
sendEmail: false
})
};
fetch('https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}', 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://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'allowedEmails' => [
'jsmith@example.com'
],
'expiresInSeconds' => 61,
'maxUses' => 2,
'sendEmail' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}"
payload := strings.NewReader("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.nectarclimate.com/v2.2/invitation/connection/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"invitationType": "<string>",
"status": "<string>",
"invitationUrl": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowedEmails": [
"jsmith@example.com"
],
"expiresAt": "2023-11-07T05:31:56Z",
"maxUses": 123,
"useCount": 123,
"created": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [
"ELECTRICITY"
],
"country": "AF",
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
},
"createdConnections": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"datasourceName": "<string>",
"status": "<string>",
"created": "2023-11-07T05:31:56Z"
}
]
}Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Request body for creating an invitation that lets a contributor update credentials on an existing connection.
Response
An invitation that grants an external contributor access to create or update a connection.