OpenAPI Specification
openapi: 3.0.1
info:
description: Activity Log
title: CarbonHub activities equipment API
version: 1.0.0
servers:
- url: https://api.validere.io
security:
- Staging: []
- Integration: []
- Local: []
tags:
- description: Manage Equipment
name: equipment
paths:
/app/v1/equipment:
post:
operationId: create_equipment
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentInput'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentWithFacility'
description: successful operation
summary: Create an Equipment
tags:
- equipment
/app/v1/equipment/filters:
get:
operationId: get_equipment_filter
parameters:
- $ref: '#/components/parameters/PageSize'
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/SortBy'
- $ref: '#/components/parameters/SortDirection'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PagedEquipmentFilterOutput'
description: successful operation
summary: List Filter
tags:
- equipment
post:
operationId: post_equipment_filter
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentFilterInput'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentFilterOutput'
description: successful operation
summary: Create Filter
tags:
- equipment
/app/v1/equipment/filters/{filter_id}:
delete:
operationId: delete_equipment_filter
parameters:
- $ref: '#/components/parameters/FilterId'
responses:
'200':
description: successful operation
summary: Delete Filter
tags:
- equipment
put:
operationId: put_equipment_filter
parameters:
- $ref: '#/components/parameters/FilterId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentFilterUpdateInput'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentFilterOutput'
description: successful operation
summary: Update Filter
tags:
- equipment
/app/v1/equipment/search:
post:
operationId: search_equipment
parameters:
- $ref: '#/components/parameters/Period'
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Paginated'
- $ref: '#/components/schemas/EquipmentSort'
- $ref: '#/components/schemas/EquipmentFilter'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PagedEquipmentList'
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
schema:
$ref: '#/components/schemas/XLSXResponse'
description: successful operation
summary: Search and list equipment
tags:
- equipment
/app/v1/equipment/export:
post:
operationId: export_equipment
parameters:
- $ref: '#/components/parameters/Period'
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/EquipmentSort'
- $ref: '#/components/schemas/EquipmentFilter'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ReportWithS3Url'
description: successful operation
summary: Export equipment
tags:
- equipment
/app/v1/equipment/{equipment_id}:
delete:
operationId: delete_equipment
parameters:
- $ref: '#/components/parameters/EquipmentId'
responses:
'200':
description: successful operation
summary: Delete Equipment
tags:
- equipment
get:
operationId: get_equipment
parameters:
- $ref: '#/components/parameters/Period'
- $ref: '#/components/parameters/EquipmentId'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentWithFacility'
description: successful operation
summary: Get an Equipment by ID
tags:
- equipment
put:
operationId: update_equipment
parameters:
- $ref: '#/components/parameters/Period'
- $ref: '#/components/parameters/EquipmentId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EquipmentUpdateInput'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Equipment'
description: successful operation
summary: Update Equipment
tags:
- equipment
components:
schemas:
PagedEquipmentFilterOutput:
allOf:
- $ref: '#/components/schemas/Pagination'
- properties:
data:
items:
$ref: '#/components/schemas/EquipmentFilterOutput'
type: array
type: object
EquipmentSort:
properties:
sort_by:
enum:
- facility_name
- name
type: string
sort_direction:
default: desc
description: sort direction
enum:
- asc
- desc
example: desc
type: string
AuditFields:
properties:
created_at:
format: date-time
type: string
updated_at:
format: date-time
type: string
created_by:
format: uuid
type: string
updated_by:
format: uuid
type: string
type: object
EquipmentFilterUpdateInput:
allOf:
- $ref: '#/components/schemas/FilterInput'
- $ref: '#/components/schemas/EquipmentFilter'
EquipmentFilter:
properties:
filter:
description: A filter object for equipment where it can filter based on any of these following fields. No fields are mandatory and the syntax is roughly the same as MongoDB querying.
example:
$or:
- facility.name: WellSite1
custom_attributes.hint: View schema for all supported fields
custom_attributes.operator:
$in:
- Bob
- Alice
- Eve
name:
$like: Compressor
$ref: '#/components/schemas/EquipmentFilterFields'
EquipmentFilterInput:
allOf:
- $ref: '#/components/schemas/FilterInput'
- $ref: '#/components/schemas/EquipmentFilter'
type: object
FilterName:
properties:
name:
type: string
example: My first filter
TemplatedReportStatus:
type: string
enum:
- active
- archived
FilterOutput:
allOf:
- $ref: '#/components/schemas/CompanyId'
- $ref: '#/components/schemas/FilterId'
- $ref: '#/components/schemas/FilterInput'
type: object
FilterStatus:
properties:
status:
$ref: '#/components/schemas/TemplatedReportStatus'
EquipmentStatus:
type: string
enum:
- active
- inactive
- deprecated
FilterId:
properties:
id:
format: uuid
type: string
EquipmentFilterFields:
allOf:
- $ref: '#/components/schemas/EquipmentPrimaryFilterFields'
- $ref: '#/components/schemas/FacilityPrimaryFilterFieldsWithPrefix'
- properties:
event.id:
type: string
type: object
AssetAttributeStartEndDateInput:
type: object
properties:
start_date:
description: Start date of attributes. If start_date is provided and end_date is not provided, it defaults to the range [start_date, max]. If both start_date and end_date are not provided, it defaults to the range [current year month, next existing year month - 1]
anyOf:
- type: string
example: 202407
description: Year month formatted as YYYYMM
- type: string
enum:
- min
- max
example: min
description: Year month shorthand
end_date:
description: End date of attributes. If end_date is provided and start_date is not provided, it defaults to the range [min, start_date]. If both start_date and end_date are not provided, it defaults to the range [current year month, next existing year month - 1]
anyOf:
- type: string
example: 202407
description: Year month formatted as YYYYMM
- type: string
enum:
- min
- max
example: max
description: Year month shorthand
Latitude:
description: latitude on the Earth
example: 51
maximum: 90
minimum: -90
nullable: true
type: number
FilterInput:
allOf:
- $ref: '#/components/schemas/FilterName'
- $ref: '#/components/schemas/FilterStatus'
- $ref: '#/components/schemas/FilterTag'
- $ref: '#/components/schemas/FilterMetadata'
PagedEquipmentList:
allOf:
- $ref: '#/components/schemas/Pagination'
- properties:
data:
items:
$ref: '#/components/schemas/EquipmentWithFacility'
type: array
type: object
Pagination:
properties:
page_number:
type: number
example: 0
page_size:
type: number
example: 10
total_entries:
type: number
example: 58
total_pages:
type: number
example: 6
type: object
FacilityPrimaryFilterFieldsWithPrefix:
properties:
facility.custom_attributes:
type: object
facility.id:
type: string
facility.name:
type: string
facility.status:
type: string
type: object
Paginated:
properties:
page:
default: 0
description: Which page to return
example: 0
type: number
page_size:
default: 10
description: How many items to list in a page
example: 20
type: number
ReportWithS3Url:
allOf:
- $ref: '#/components/schemas/ReportWithTemplatedReportResponse'
- properties:
s3_download_link:
type: string
type: object
XLSXResponse:
format: binary
type: string
FilterTag:
properties:
tag:
type: string
CompanyId:
properties:
id:
format: uuid
type: string
Longitude:
description: longitude on the Earth
example: -114
maximum: 180
minimum: -180
nullable: true
type: number
FacilityNameAndId:
example:
id: 1ca1117d-f2d6-47f5-ae3a-aa1025073717
name: Facility 1
properties:
custom_attributes:
$ref: '#/components/schemas/CustomAttributes'
id:
format: uuid
type: string
name:
type: string
type: object
EquipmentFilterOutput:
allOf:
- $ref: '#/components/schemas/FilterOutput'
- $ref: '#/components/schemas/EquipmentFilter'
- properties:
entity_type:
example: equipment
type: string
type: object
EquipmentTypeShallow:
properties:
id:
type: string
name:
type: string
type: object
Equipment:
properties:
custom_attributes:
$ref: '#/components/schemas/CustomAttributes'
effective_date:
example: '2022-01-01'
type: string
id:
format: uuid
type: string
latitude:
$ref: '#/components/schemas/Latitude'
longitude:
$ref: '#/components/schemas/Longitude'
name:
type: string
type:
$ref: '#/components/schemas/EquipmentTypeShallow'
type: object
EquipmentUpdateInput:
allOf:
- properties:
custom_attributes:
$ref: '#/components/schemas/CustomAttributes'
latitude:
$ref: '#/components/schemas/Latitude'
longitude:
$ref: '#/components/schemas/Longitude'
name:
type: string
type_id:
$ref: '#/components/schemas/EquipmentTypeId'
description: Equipment Type ID
example: ng_pneumatic_devices
status:
$ref: '#/components/schemas/EquipmentStatus'
facility_id:
description: ID of the facility that the equipment belongs to
type: string
format: uuid
type: object
- $ref: '#/components/schemas/AssetAttributeStartEndDateInput'
EquipmentPrimaryFilterFields:
properties:
id:
type: string
name:
type: string
status:
$ref: '#/components/schemas/EquipmentStatus'
type.id:
type: string
type.name:
type: string
custom_attributes:
type: object
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
type: object
CustomAttributes:
example:
attribute1: 12345
attribute2: value1
type: object
ReportWithTemplatedReportResponse:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
minLength: 3
maxLength: 128
company_id:
type: string
format: uuid
status:
type: string
enum:
- exporting
- failed
- success
templated_report_name:
type: string
input:
type: object
additionalProperties:
nullable: true
description: User input for a templated report based on the input schema for the desired templated report.
example:
year_month: 202201
reporting_group_id: bc37cb31-08ce-4b22-8f4c-7d44692a4ef2
asset_id: 89c100dc-0401-447f-a9f5-72ae124f3244
s3_object_id:
type: string
report_version:
type: string
created_at:
anyOf:
- type: string
format: date-time
- type: string
nullable: true
- nullable: true
updated_at:
anyOf:
- type: string
format: date-time
- type: string
nullable: true
- nullable: true
created_by:
type: string
format: uuid
updated_by:
type: string
format: uuid
templated_report:
type: object
properties:
name:
type: string
minLength: 3
maxLength: 64
pattern: ^\w+$
display_name:
type: string
minLength: 3
maxLength: 64
status:
type: string
enum:
- active
- archived
default: active
input_schema:
type: object
additionalProperties:
type: object
properties:
display_name:
type: string
minLength: 3
maxLength: 64
data_type:
type: string
enum:
- boolean
- number
- integer
- pick-list
- multi-pick-list
- string
- geo_point
- number-array
- lookup
- date
- date-time
- date-time-range
- file
description:
type: string
maxLength: 256
is_required:
type: boolean
lookup_entity_type:
type: string
enum:
- equipment
- device
- facility
- flow
- asset_group
- form_schema
lookup_entity_attribute:
type: string
pick_list_values:
type: array
items:
type: string
order:
type: integer
required:
- display_name
- data_type
- description
- is_required
additionalProperties: false
default: {}
is_embedded:
type: boolean
default: false
use_data_layer_v2:
type: boolean
default: false
description:
type: string
maxLength: 256
deduplication_columns:
type: object
additionalProperties:
type: array
items:
type: string
minLength: 3
maxLength: 64
pattern: ^[A-Za-z0-9_]+$
maxItems: 20
row_styling_headers:
type: object
additionalProperties:
type: string
minLength: 3
maxLength: 64
pattern: ^[A-Za-z0-9_]+$
created_at:
anyOf:
- type: string
format: date-time
- type: string
nullable: true
- nullable: true
updated_at:
anyOf:
- type: string
format: date-time
- type: string
nullable: true
- nullable: true
required:
- name
- display_name
- created_at
- updated_at
s3_download_link:
type: string
required:
- id
- name
- company_id
- status
- created_at
- updated_at
- created_by
- updated_by
additionalProperties: false
EquipmentInput:
properties:
custom_attributes:
$ref: '#/components/schemas/CustomAttributes'
effective_date:
example: '2022-01-01'
type: string
facility_id:
description: ID of the facility that the equipment belongs to
type: string
latitude:
$ref: '#/components/schemas/Latitude'
longitude:
$ref: '#/components/schemas/Longitude'
name:
type: string
status:
$ref: '#/components/schemas/EquipmentStatus'
type_id:
$ref: '#/components/schemas/EquipmentTypeId'
type: object
EquipmentTypeId:
type: string
enum:
- acid_gas_removal
- desiccant_dehydrator
- ng_pneumatic_devices
EquipmentWithFacility:
allOf:
- $ref: '#/components/schemas/AuditFields'
- properties:
custom_attributes:
$ref: '#/components/schemas/CustomAttributes'
effective_date:
example: '2022-01-01'
type: string
facility:
$ref: '#/components/schemas/FacilityNameAndId'
id:
type: string
latitude:
$ref: '#/components/schemas/Latitude'
longitude:
$ref: '#/components/schemas/Longitude'
name:
type: string
status:
$ref: '#/components/schemas/EquipmentStatus'
type:
$ref: '#/components/schemas/EquipmentTypeShallow'
type: object
FilterMetadata:
properties:
metadata:
type: array
items:
type: object
example:
- key: calculator_configuration.year_month
isSelected: true
- key: flow.type
isSelected: false
parameters:
PageSize:
description: page size
in: query
name: page_size
required: false
schema:
type: number
FilterId:
description: Filter ID
example: 748970de-fd1f-4494-ae3f-47cc21ff205f
in: path
name: filter_id
required: true
schema:
format: uuid
type: string
Period:
description: year month (YYYYMM), defaulting to the current time, indicates which time period to return the attributes and custom attributes from
in: query
name: period
required: false
schema:
type: string
SortBy:
description: sort by
in: query
name: sort_by
required: false
schema:
type: string
Page:
description: page number
in: query
name: page
required: false
schema:
type: number
EquipmentId:
description: Id of equipment
example: 748970de-fd1f-4494-ae3f-47cc21ff205f
in: path
name: equipment_id
required: true
schema:
format: uuid
type: string
SortDirection:
description: sort direction
example: desc
in: query
name: sort_direction
required: false
schema:
enum:
- asc
- desc
type: string