Pay-per-use API

Pay-per-use API

Handle your clients accounts with these API end points.

Each client will get an unique ID. If you work with your own client IDs, please note the following:

  • Internally, each ID is preceded by a prefix.
  • Your client ID MUST NOT have more than 20 characters.
  • All Responses that contain an ID are shown with this prefix.
  • If you make requests that require an ID, you can use either
    • your own ID (without prefix) or
    • our internal ID (with prefix)

API end points

Base URI:

https://api.forecast.solar/:apikey/payperuse

:apikey : Your administrative API key

The response format can be controlled with the Accept header, as described in the documentation.

If the response status code is 404, the API key is probably incorrect.

Create account

POST /account/create

Create a client account connected to your account.

Payload: If you want to use your own ID for the account, pass this as POST field id, otherwise a unique ID will be created.

To reactivate a suspended account, just use this route for the ID again. This will then also assign a new API key.

Response:

  • 200 on success with account data

Accounts information

GET /accounts

Information about all your clients accounts.

Response:

  • 200 on success with all accounts data

Account information

GET /account/:id

Information about one specific clients account.

Response:

  • 200 on success with account data
  • 404 on failure, invalid id

Accounts statistics

GET /usage(/:year)(/:month)(/:day)

Get the usage statistics for your client accounts for a year, month or day.

If no variable parameter is given, defaults to current year.

Response:

  • 200 on success with usage statistics per requested time period and account

Reset API key

POST /account/reset

Assigns a new API key for a given client account.

Payload: POST body parameter id is required.

Response:

  • 200 on success with new account data
  • 404 on failure, missing or invalid id

Suspend account

POST /account/suspend

Invalidate a given client account (just sets the expiration date to yesterday).

Payload: POST body parameter id is required.

To reactivate a suspended client account, use the Create account route for the ID again. This will then also assign a new API key.

Suspended client accounts are permanently deleted after 1 year.

You can not suspend your administrative account 8-)

Response:

  • 200 on success with account data
  • 404 on failure, missing or invalid id

Delete account

POST /account/delete

Delete a given client account final.

Payload: POST body parameter id is required.

You can not delete your administrative account 8-)

Response:

  • 204 on success
  • 404 on failure, missing or invalid id