Generators
This section covers the API endpoints for managing generators. You can use these endpoints to retrieve, create, update, and delete generator information in your application.
The generator model
The generator model contains detailed information about solar generators. Here are the properties included in the generator model:
Properties
-
- Name
id
- Type
- integer
- Description
-
Unique identifier for the generator.
-
- Name
address
- Type
- string
- Description
-
Address of the generator.
-
- Name
city
- Type
- string
- Description
-
City where the generator is located.
-
- Name
state
- Type
- string
- Description
-
State where the generator is located.
-
- Name
zip_code
- Type
- string
- Description
-
ZIP code of the generator's location.
-
- Name
nameplate_capacity
- Type
- decimal
- Description
-
Nameplate capacity of the generator in watts.
-
- Name
online_date
- Type
- date
- Description
-
Date when the generator went online.
-
- Name
latitude
- Type
- decimal
- Description
-
Latitude coordinate of the generator.
-
- Name
longitude
- Type
- decimal
- Description
-
Longitude coordinate of the generator.
-
- Name
homeowner_id
- Type
- integer
- Description
-
ID of the homeowner associated with this generator.
-
- Name
created_at
- Type
- timestamp
- Description
-
Timestamp of when the generator record was created.
-
- Name
updated_at
- Type
- timestamp
- Description
-
Timestamp of when the generator record was last updated.
List all generators
This endpoint allows you to retrieve a paginated list of all generators that belong to your account. By default, a maximum of ten generators are shown per page.
Optional parameters
-
- Name
limit
- Type
- integer
- Description
-
Limit the number of generators returned (default: 10, max: 100).
-
- Name
page
- Type
- integer
- Description
-
Page number for pagination (default: 1).
Request
curl -G https://api.getcurrents.com/v1/generators \
-H "Authorization: Bearer {token}" \
-d limit=10 \
-d page=1
Response
{
"data": [
{
"id": 1,
"address": "123 Solar St",
"city": "Sunnyville",
"state": "CA",
"zip_code": "12345",
"nameplate_capacity": 5000.00,
"online_date": "2023-01-01",
"latitude": 37.7749,
"longitude": -122.4194,
"homeowner_id": 1,
"created_at": "2023-10-02T18:24:47.000000Z",
"updated_at": "2023-10-02T18:24:47.000000Z"
},
// ... more generators
],
"links": {
"first": "https://api.getcurrents.com/v1/generators?page=1",
"last": "https://api.getcurrents.com/v1/generators?page=5",
"prev": null,
"next": "https://api.getcurrents.com/v1/generators?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 5,
"path": "https://api.getcurrents.com/v1/generators",
"per_page": 10,
"to": 10,
"total": 50
}
}
List generators for a specific homeowner
This endpoint allows you to retrieve a paginated list of all generators that belong to a specific homeowner.
Required parameters
-
- Name
homeowner_id
- Type
- integer
- Description
-
The ID of the homeowner whose generators you want to retrieve.
Optional parameters
-
- Name
limit
- Type
- integer
- Description
-
Limit the number of generators returned (default: 10, max: 100).
-
- Name
page
- Type
- integer
- Description
-
Page number for pagination (default: 1).
Request
curl -G https://api.getcurrents.com/v1/homeowners/1/generators \
-H "Authorization: Bearer {token}" \
-d limit=10 \
-d page=1
Response
{
"data": [
{
"id": 1,
"address": "123 Solar St",
"city": "Sunnyville",
"state": "CA",
"zip_code": "12345",
"nameplate_capacity": 5000.00,
"online_date": "2023-01-01",
"latitude": 37.7749,
"longitude": -122.4194,
"homeowner_id": 1,
"created_at": "2023-10-02T18:24:47.000000Z",
"updated_at": "2023-10-02T18:24:47.000000Z"
},
// ... more generators for this homeowner
],
"links": {
"first": "https://api.getcurrents.com/v1/homeowners/1/generators?page=1",
"last": "https://api.getcurrents.com/v1/homeowners/1/generators?page=2",
"prev": null,
"next": "https://api.getcurrents.com/v1/homeowners/1/generators?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 2,
"path": "https://api.getcurrents.com/v1/homeowners/1/generators",
"per_page": 10,
"to": 10,
"total": 15
}
}
Create a generator
This endpoint allows you to add a new generator to your application. You need to provide the required generator information in the request body.
Required attributes
-
- Name
address
- Type
- string
- Description
-
Address of the generator.
-
- Name
city
- Type
- string
- Description
-
City where the generator is located.
-
- Name
state
- Type
- string
- Description
-
State where the generator is located.
-
- Name
zip_code
- Type
- string
- Description
-
ZIP code of the generator's location.
-
- Name
nameplate_capacity
- Type
- decimal
- Description
-
Nameplate capacity of the generator in watts.
-
- Name
online_date
- Type
- date
- Description
-
Date when the generator went online.
-
- Name
latitude
- Type
- decimal
- Description
-
Latitude coordinate of the generator.
-
- Name
longitude
- Type
- decimal
- Description
-
Longitude coordinate of the generator.
-
- Name
homeowner_id
- Type
- integer
- Description
-
ID of the homeowner associated with this generator.
Request
curl https://api.getcurrents.com/v1/generators \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"address": "123 Solar St",
"city": "Sunnyville",
"state": "CA",
"zip_code": "12345",
"nameplate_capacity": 5000.00,
"online_date": "2023-01-01",
"latitude": 37.7749,
"longitude": -122.4194,
"homeowner_id": 1
}'
Response
{
"id": 1,
"address": "123 Solar St",
"city": "Sunnyville",
"state": "CA",
"zip_code": "12345",
"nameplate_capacity": 5000.00,
"nameplate_capacity": 6000.00,
"online_date": "2023-01-01",
"created_at": "2023-10-02T18:24:47.000000Z",
"updated_at": "2023-10-02T19:30:00.000000Z"
}
Delete a generator
This endpoint allows you to delete a generator from your application. Note: This action cannot be undone.
Request
curl -X DELETE https://api.getcurrents.com/v1/generators/1 \
-H "Authorization: Bearer {token}"
Response
{
"message": "Generator deleted successfully"
}