forked from microsoft/PowerPlatformConnectors
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co2 Signal (Independent Publisher) (microsoft#1305)
* Initial commit * Validation compliance * Update Readme.md * Update Readme.md * Update apiProperties.json * Corrected formatting and brand color * Correct icon color
- Loading branch information
1 parent
e8c64ec
commit 1d24313
Showing
3 changed files
with
359 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# CO2 Signal Connector | ||
Get the most recent carbon intensity numbers for any country on the map. CO2 Signal API allows you to get access to information about | ||
|
||
* where the electricity in a specific region comes from | ||
* how it was produced | ||
* how much carbon was emitted to produce it | ||
|
||
## Pre-requisites | ||
CO2 Signal uses API keys to allow access to the API. You can get an API key [here](https://co2signal.com/). | ||
CO2 Signal expects the API key to be included as a header in all requests to the server: | ||
auth-token: myapitoken | ||
|
||
## Publisher: Paul Culmsee | ||
|
||
## Supported Operations | ||
The connector supports the following operations: | ||
|
||
### Get available zones | ||
Get all Countries and zones available. | ||
|
||
### Get latest by country code | ||
Get the list of network stations. | ||
|
||
### Get latest by geographic coordinate | ||
Get a single network station record by its ID. | ||
|
||
## Known Issues and Limitations | ||
* The API has a rate limit of 30 requests per hour and max 1 request per second. the latter limit means Power Automate users may see 429 errors. | ||
|
||
* This API is free for non-commercial use. [Reach out](mailto://hello@electricitymap.org) to Co2 Signal if you plan to commercialise it. | ||
|
||
* Always update this connector via the command line tool. The custom connector UI will report and error with the "Remote Auth Reader" policy because the UI does not allow an empty value. If you save the connector via the custom connector UI, it writes an invalid value to the policy which will stop the Get Zones endpoint from working. | ||
``` | ||
paconn create --api-def apiDefinition.swagger.json --api-prop apiProperties.json. | ||
``` | ||
|
||
* One of the endpoints in this connector calls a different API - the Electricity Market API. Electricitymarket owns the CO2 Signal API and recommend this API in their documentation. | ||
|
||
## Frequently Asked Questions | ||
This API is free for non-commercial use. Reach out to us if you plan to commercialise it. | ||
|
||
|
235 changes: 235 additions & 0 deletions
235
independent-publisher-connectors/CO2 Signal/apiDefinition.swagger.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "CO2 Signal", | ||
"description": "Co2 Signal intent is to allow users to consume electricity when its carbon footprint is lowest. \n\nBy using electricity at the right time, your device favors low-carbon sources of electricity", | ||
"version": "1.0", | ||
"contact": { | ||
"name": "Paul Culmsee", | ||
"url": "https://sevensigma.com.au", | ||
"email": "paul.culmsee@sevensigma.com.au" | ||
} | ||
}, | ||
"host": "api.co2signal.com", | ||
"basePath": "/v1", | ||
"schemes": [ | ||
"https" | ||
], | ||
"consumes": [], | ||
"produces": [], | ||
"paths": { | ||
"/latest": { | ||
"get": { | ||
"responses": { | ||
"200": { | ||
"description": "default", | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"_disclaimer": { | ||
"type": "string", | ||
"description": "Data Disclaimer" | ||
}, | ||
"status": { | ||
"type": "string", | ||
"description": "Status" | ||
}, | ||
"countryCode": { | ||
"type": "string", | ||
"description": "Country Code" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"properties": { | ||
"datetime": { | ||
"type": "string", | ||
"description": "Date/time" | ||
}, | ||
"carbonIntensity": { | ||
"type": "integer", | ||
"format": "int32", | ||
"description": "Carbon Intensity" | ||
}, | ||
"fossilFuelPercentage": {} | ||
}, | ||
"description": "Zone Data" | ||
}, | ||
"units": { | ||
"type": "object", | ||
"properties": { | ||
"carbonIntensity": { | ||
"type": "string", | ||
"description": "Carbon intensity units" | ||
} | ||
}, | ||
"description": "Units of measure" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"summary": "Get latest by country code or zone", | ||
"description": "This endpoint retrieves the last known state of a country. It is also possible to get data for a specific zone, in case the country is divided by zones seen on app.electricitymap.org", | ||
"operationId": "GetLatestbyCode", | ||
"parameters": [{ | ||
"name": "countryCode", | ||
"in": "query", | ||
"required": true, | ||
"type": "string", | ||
"description": "Country or Zone", | ||
"x-ms-summary": "Country or Zone", | ||
"x-ms-visibility": "important", | ||
"x-ms-dynamic-values": { | ||
"operationId": "GetZones", | ||
"value-path": "Name", | ||
"value-collection": "Zones", | ||
"value-title": "Details/zoneName" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"/latestbyloc": { | ||
"get": { | ||
"responses": { | ||
"200": { | ||
"description": "default", | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"_disclaimer": { | ||
"type": "string", | ||
"description": "Data Disclaimer" | ||
}, | ||
"status": { | ||
"type": "string", | ||
"description": "status" | ||
}, | ||
"countryCode": { | ||
"type": "string", | ||
"description": "Country Code" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"properties": { | ||
"datetime": { | ||
"type": "string", | ||
"description": "Date/time" | ||
}, | ||
"carbonIntensity": { | ||
"type": "integer", | ||
"format": "int32", | ||
"description": "Carbon Intensity" | ||
}, | ||
"fossilFuelPercentage": {} | ||
}, | ||
"description": "Zone Data" | ||
}, | ||
"units": { | ||
"type": "object", | ||
"properties": { | ||
"carbonIntensity": { | ||
"type": "string", | ||
"description": "Carbon intensity units" | ||
} | ||
}, | ||
"description": "Units of measure" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"summary": "Get latest by geographic coordinate", | ||
"description": "Get latest by geographic coordinate", | ||
"operationId": "GetLatestbyLatLon", | ||
"parameters": [{ | ||
"name": "lon", | ||
"in": "query", | ||
"required": false, | ||
"type": "number", | ||
"description": "Longitude", | ||
"x-ms-summary": "Latitude" | ||
}, { | ||
"name": "lat", | ||
"in": "query", | ||
"required": false, | ||
"type": "number", | ||
"description": "Latitude", | ||
"x-ms-summary": "Latitude" | ||
} | ||
] | ||
} | ||
}, | ||
"/zones": { | ||
"get": { | ||
"responses": { | ||
"200": { | ||
"description": "default", | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"Zones": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"Name": { | ||
"type": "string", | ||
"description": "Name" | ||
}, | ||
"Details": { | ||
"type": "object", | ||
"properties": { | ||
"zoneName": { | ||
"type": "string", | ||
"description": "Zone Name" | ||
}, | ||
"countryName": { | ||
"type": "string", | ||
"description": "Country Name" | ||
} | ||
}, | ||
"description": "Details for Zone" | ||
} | ||
} | ||
}, | ||
"description": "Zone List" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"summary": "Get Available Zones", | ||
"description": "A list of countries and zones by code (zone being the country is divided by zones seen on app.electricitymap.org)", | ||
"operationId": "GetZones", | ||
"parameters": [] | ||
} | ||
} | ||
}, | ||
"definitions": {}, | ||
"parameters": {}, | ||
"responses": {}, | ||
"securityDefinitions": { | ||
"API Key": { | ||
"type": "apiKey", | ||
"in": "header", | ||
"name": "auth-token" | ||
} | ||
}, | ||
"security": [{ | ||
"API Key": [] | ||
} | ||
], | ||
"tags": [], | ||
"x-ms-connector-metadata": [{ | ||
"propertyName": "Website", | ||
"propertyValue": "https://co2signal.com" | ||
}, { | ||
"propertyName": "Privacy policy", | ||
"propertyValue": "https://co2signal.com/" | ||
}, { | ||
"propertyName": "Categories", | ||
"propertyValue": "Data" | ||
} | ||
] | ||
} |
82 changes: 82 additions & 0 deletions
82
independent-publisher-connectors/CO2 Signal/apiProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"properties": { | ||
"connectionParameters": { | ||
"api_key": { | ||
"type": "securestring", | ||
"uiDefinition": { | ||
"displayName": "API Key", | ||
"description": "The API Key for this api", | ||
"tooltip": "Provide your API Key", | ||
"constraints": { | ||
"tabIndex": 2, | ||
"clearText": false, | ||
"required": "true" | ||
} | ||
} | ||
} | ||
}, | ||
"iconBrandColor": "#da3b01", | ||
"capabilities": [], | ||
"policyTemplateInstances": [ | ||
{ | ||
"templateId": "routerequesttoendpoint", | ||
"title": "Fix Header", | ||
"parameters": { | ||
"x-ms-apimTemplateParameter.newPath": "/latest", | ||
"x-ms-apimTemplateParameter.httpMethod": "@Request.OriginalHTTPMethod" | ||
} | ||
}, | ||
{ | ||
"templateId": "dynamichosturl", | ||
"title": "Set Zone Host", | ||
"parameters": { | ||
"x-ms-apimTemplateParameter.urlTemplate": "https://api.electricitymap.org", | ||
"x-ms-apimTemplate-operationName": [ | ||
"GetZones" | ||
] | ||
} | ||
}, | ||
{ | ||
"templateId": "routerequesttoendpoint", | ||
"title": "Set Zone Path", | ||
"parameters": { | ||
"x-ms-apimTemplateParameter.newPath": "/v3/zones", | ||
"x-ms-apimTemplateParameter.httpMethod": "@Request.OriginalHTTPMethod", | ||
"x-ms-apimTemplate-operationName": [ | ||
"GetZones" | ||
] | ||
} | ||
}, | ||
{ | ||
"templateId": "setheader", | ||
"title": "Remove Auth Header", | ||
"parameters": { | ||
"x-ms-apimTemplateParameter.name": "auth-token", | ||
"x-ms-apimTemplateParameter.value": "", | ||
"x-ms-apimTemplateParameter.existsAction": "override", | ||
"x-ms-apimTemplate-policySection": "Request", | ||
"x-ms-apimTemplate-operationName": [ | ||
"GetZones" | ||
] | ||
} | ||
}, | ||
{ | ||
"templateId": "convertobjecttoarray", | ||
"title": "Process Zone Payload", | ||
"parameters": { | ||
"x-ms-apimTemplateParameter.propertyParentPath": "@body()", | ||
"x-ms-apimTemplateParameter.propertySubPath": "null", | ||
"x-ms-apimTemplateParameter.newPropertyPath": "@body().Zones", | ||
"x-ms-apimTemplateParameter.keyName": "Name", | ||
"x-ms-apimTemplateParameter.valueName": "Details", | ||
"x-ms-apimTemplate-policySection": "Response", | ||
"x-ms-apimTemplate-operationName": [ | ||
"GetZones" | ||
] | ||
} | ||
} | ||
], | ||
"publisher": "Paul Culmsee", | ||
"stackOwner" : "https://co2signal.com/" | ||
} | ||
} |