HomeGuidesAPI ReferenceChangelog
Log In
API Reference

Update Account Info and Properties with {accountId}

This endpoint allows you to add and update Account information and properties using the {accountId}.

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:

  • Any entry in the account.properties array.
  • The top level or "header" fields such as accountName, accountManager, or status.
  • The addressString and the other fields in the account.address sub-object.
  • The masterTariffId in the account.tariffs array.

Below are a few examples of what this endpoint can be used for:

Resource URI

POST /rest/v1/accounts/{accountId}/properties  
PUT /rest/v1/accounts/{accountId}/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 methods would work):

PUT /rest/v1/accounts/9a6035d8-94cd-4d66-8a94-eac573fec42e/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

This 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, customerOrgName, customerOrgId, and the other top-level fields. Call the following:

PUT /rest/v1/accounts/9a6035d8-94cd-4d66-8a94-eac573fec42e/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/9a6035d8-94cd-4d66-8a94-eac573fec42e/properties

Note that in this case, we've set the optional accuracy field. What this call is 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  
      }  
   ]  
}

Conclusion

The result of all three of these example calls is that buildingArea is now in the properties collection, the account type is now set, and the masterTariffId is confirmed.

Making a call to the Get Account endpoint shows these are now set.

GET /rest/v1/accounts/9a6035d8-94cd-4d66-8a94-eac573fec42e/properties

{  
   "status": "success",  
   "count": 1,  
   "type": "Account",  
   "results": \[  
      {  
         "accountId": "9a6035d8-94cd-4d66-8a94-eac573fec42e",  
         "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,
Language
Credentials
Basic
base64
:
Click Try It! to start a request and see the response here!