Get Overall User Impact | Climes API
This endpoint fetches the users impact for multiple orders and sends all the individual impacts along with the overall results.
Request Parameters
Request Query Schema
Name | Description | Type |
---|---|---|
This is the Base64 encoded email of user used while creating an order. | Base64 encoded string | |
phone | This is the Base64 encoded phone of user used while creating an order. | Base64 encoded string |
impacts | true | false depending on whether you need detailed information | Boolean |
tip
Either email
or phone
are required. But when email
and phone
both are sent in the request the first preference for searching will be given to the email
and second will be given to the phone
.
If you send impact
: true
we will also send back the detailed vote based impact by this user, this will make the endpoint slower through, so do set it to false
if it is not required and only overall impact is needed
Endpoint
/v3/integrations/vote/customer?email=BASE64_EMAIL&impacts=true
/v3/integrations/vote/customer?phone=BASE64_PHONE&impacts=true
Method
GET
Headers
{
'x-api-key' : 'API_KEY'
}
Response Parameters
Response Schema
Each response has an overall
object and impacts
array which has individual impact object
Name | Description | Type |
---|---|---|
customer_exists | This denotes whether if the user with such email and phone exists or not. | boolean |
overall | This has the overall data cumulative of all the impacts .This has individual overall object in it. | object |
impacts | This is an array of multiple impacts of user. This has individual impact object. This field will only be sent optionally if the impacts are sent as true in query params during the request. | array |
Overall Schema
Name | Description | Type |
---|---|---|
total_climes | This is the total climes across all impacts that were sent while creating an order which are now allocated to any project. | number |
total_kg_co2_removed | This is the Kgs CO2e equivalent of total_climes bought. | number |
equivalents | This object contains the equivalent values for the total_kg_co2_removed . This has individual equivalents object. | object |
Impact Schema
Name | Description | Type |
---|---|---|
partner_order_id | This is the partner_order_id send while creating the order. | string |
climes | This is the total climes that were sent while creating an order which are now allocated to the project_id | number |
kg_co2_removed | This is the Kgs CO2e equivalent of climes bought. | number |
certificate_link | This is the certificate link denoting that the climes have been allocated to the said project by the user. | string |
project_name | This is the name of the project supported by this user with their climes. | string |
project_id | This is the project_id for the project which is supported by the user. Additional details for the project are available at Get Projects API | string |
allocation_date | This is the UTC time at which the user chose the project. | UTC string |
order_date | This is the UTC time at which the order was placed. | UTC string |
equivalents | This object contains the equivalent values for the kg_co2_removed . This has individual equivalents object. | object |
Equivalents Schema
Name | Description | Type |
---|---|---|
trashbags_recycled | Its the total number of trash bags collected for recycle for the kg_co2_removed | number |
seedlings_grown | Its the total number of seedlings planted and grown for 10 years for the amount of kg_co2_removed | number |
electricity_saved | Its the total hours of electricity saved for the kg_co2_removed | number |
Status Code
200
Response Data
{
"customer_exists" : true,
"overall" : {
"total_climes" : 1114,
"total_kg_co2_removed" : 1114,
"equivalents" : {
"trashbags_recycled" : 48,
"seedlings_grown" : 18,
"electricity_saved" : 512
}
},
"impacts" : [
{
"partner_order_id" : "876287372837786837",
"climes" : 557,
"kg_co2_removed" : 557,
"certificate_link": "climes-certificate-link",
"project_name" : "Making biodiverse forests financially viable for farmers",
"project_id" : "farmers-for-forests",
"allocation_date" : "2023-06-22T06:35:22.314Z",
"order_date" : "2023-06-21T02:29:50.251Z",
"equivalents" : {
"trashbags_recycled" : 24,
"seedlings_grown" : 9,
"electricity_saved" : 256
}
},
{
"partner_order_id" : "876273783778683728",
"climes" : 557,
"kg_co2_removed" : 557,
"certificate_link": "climes-certificate-link",
"project_name" : "Agroforestry to combat land degradation in Karnataka",
"project_id": "say-trees",
"allocation_date" : "2023-05-13T05:24:42.454Z",
"order_date" : "2023-05-01T06:33:47.324Z",
"equivalents" : {
"trashbags_recycled" : 24,
"seedlings_grown" : 9,
"electricity_saved" : 256
}
}
]
}
Sample Request
- cURL
- NodeJs
- Axios
- Python
- Php
curl --location --request GET 'BASE_URL/v3/integrations/vote/customer?email=am9obmRvZTU2NzU1MzNAZ21haWwuY29t'
--header 'x-api-key: API_KEY'
const fetch = require('node-fetch');
const baseUrl = 'BASE_URL/v3/integrations/vote/customer?email=am9obmRvZTU2NzU1MzNAZ21haWwuY29t';
const apiKey = 'API_KEY';
const headers = {
'x-api-key': apiKey
};
fetch(baseUrl, { headers })
.then(response => response.json())
.then(data => {
console.log(data); // Handle the response data here
})
.catch(error => {
console.error(error); // Handle any errors that occur during the request
});
var axios = require('axios');
var config = {
method: 'get',
url: 'BASE_URL/v3/integrations/vote/customer?email=am9obmRvZTU2NzU1MzNAZ21haWwuY29t',
headers: {
'x-api-key': 'API_KEY'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requestsm
url = "BASE_URL/v3/integrations/vote/customer?email=am9obmRvZTU2NzU1MzNAZ21haWwuY29t"
payload={}
headers = {
'x-api-key': 'API_KEY'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('BASE_URL/v3/integrations/vote/customer?email=am9obmRvZTU2NzU1MzNAZ21haWwuY29t');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => 'API_KEY'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Sample Response
Below are sample responses for the above sample request.
Responses
- Success - 200
- Failure - 400
{
"customer_exists": true,
"overall": {
"total_climes": 1114,
"total_kg_co2_removed": 1114,
"equivalents": {
"trashbags_recycled": 48,
"seedlings_grown": 18,
"electricity_saved": 512
}
},
"impacts": [
{
"partner_order_id": "876287372837786837",
"climes": 557,
"kg_co2_removed": 557,
"certificate_link": "climes-certificate-link",
"project_name": "Making biodiverse forests financially viable for farmers",
"project_id": "farmers-for-forests",
"allocation_date": "2023-06-22T06:35:22.314Z",
"order_date": "2023-06-21T02:29:50.251Z",
"equivalents": {
"trashbags_recycled": 24,
"seedlings_grown": 9,
"electricity_saved": 256
}
},
{
"partner_order_id": "876273783778683728",
"climes": 557,
"kg_co2_removed": 557,
"certificate_link": "climes-certificate-link",
"project_name": "Agroforestry to combat land degradation in Karnataka",
"project_id": "say-trees",
"allocation_date": "2023-05-13T05:24:42.454Z",
"order_date": "2023-05-01T06:33:47.324Z",
"equivalents": {
"trashbags_recycled": 24,
"seedlings_grown": 9,
"electricity_saved": 256
}
}
]
}
{
"customer_exists": false,
"message": "Customer Info with this identifier not found for this partner"
}