This handy method allows you to set one field on the account. It's smart enough to add or update the field's value as it needs to. It also allows you to add or update practically any data field on the account including:
The top level or "header" fields such as accountName, owner or status
Any entry in the account.properties array
addressString and the other fields in the account.address sub-object
masterTariffIds in the account.tariffs array.
We have some examples below for all of these.
Resource URI
POST /rest/v1/accounts/{accountId}/properties
PUT /rest/v1/accounts/{accountId}/properties
POST /rest/v1/accounts/pid/{providerAccountId}/properties
PUT /rest/v1/accounts/pid/{providerAccountId}/properties
Example 1 - Set properties collection values
The first example shows how to set a value in the properties collection on the account (i.e. the account.properties field). Here we are setting the building's area to 2,000 square feet. Call the following (POST or PUT would work):
PUT /rest/v1/accounts/pid/api-eg-008/properties
With this request body:
{
"keyName":"buildingArea",
"dataValue":"2000"
}
The following would be returned:
{
"status": "success",
"count": 1,
"type": "PropertyData",
"results": [
{
"keyName": "buildingArea",
"dataType": null,
"dataValue": "2000"
}
]
}
Example 2 - Set an account "header" field
The next example shows how to set one of the top-level or "header" fields on the account. In this case, we are setting the type field to "POTENTIAL" but you could do something similar for accountName, owner, customerOrgId, and the other top-level fields defined above. Call the following:
PUT /rest/v1/accounts/pid/api-eg-008/properties
With this request body:
{
"keyName":"type",
"dataValue":"POTENTIAL"
}
The following would be returned.
{
"status": "success",
"count": 1,
"type": "PropertyData",
"results": [
{
"keyName": "type",
"dataType": null,
"dataValue": "POTENTIAL"
}
]
}
Example 3 - Set tariff data
For our final example, we use this endpoint to set the electric tariff for the account.
PUT /rest/v1/accounts/pid/api-eg-008/properties
Note that in this case, we've set the optional accuracy field. What this call is actually doing is confirming that the tariff that was defaulted is correct (100 means 100% accurate). Not passing in accuracy also means 100%. This call also supports passing in fromDateTime and/or toDateTime to add or update a tariff for a specific range. Note that this endpoint is only for electricity tariffs. Solar or other service types aren't supported here. Similarly, contracted rates or tax rates aren't supported either. To do those use the Add or Update Account Tariff endpoint.
{
"keyName":"masterTariffId",
"dataValue":"522",
"accuracy":100
}
This will return back:
{
"status": "success",
"count": 1,
"type": "PropertyData",
"results": [
{
"keyName": "masterTariffId",
"dataType": null,
"dataValue": "522",
"accuracy": 100
}
]
}
The result of all three of these calls is that buildingArea is in the properties collection, type is now set, and the tariff is confirmed. Making a call to the Get Account endpoint shows these are now set.
{
"status": "success",
"count": 1,
"type": "Account",
"results": \[
{
"accountId": "4b1dd606-a72a-46b2-8c12-34db20be69fa",
"providerAccountId": "api-eg-008",
"accountName": "Example API Solar projection",
"customerOrgId": null,
"customerOrgName": null,
"address": {
"addressString": "221 Main Street, San Francisco, CA 94105, USA",
"state": "CA",
"zip": "94105",
"country": "US",
"lon": -122.39268,
"lat": 37.790188
},
"owner": "Mr Sun",
"status": "ACTIVE",
"type": "POTENTIAL",
"properties": {
"buildingArea": {
"keyName": "buildingArea",
"dataType": null,
"dataValue": "2000"
},
"customerClass": {
"keyName": "customerClass",
"dataType": "CHOICE",
"dataValue": "1"
},
"territoryId": {
"keyName": "territoryId",
"dataType": null,
"dataValue": "3534"
}
},
"tariffs": \[
{
"masterTariffId": 522,
"customerClass": null,
"customerLikelihood": 100,