Zum Inhalt springen
Lebenszyklus

Record an event in the life of a unit

Scope: conditionSiehe auch:Authentifizierung ·Fehler ·Paginierung ·Ratenlimits
POST
/batteries/{batteryId}/lifecycle-events

Editor and above, or an API key with the condition scope (source api, ADR-017). occurred_on lies between the manufacturing date and today. evidence_ids name documents of the evidence library (a diagnostic report, a repair protocol). Events are records: they do not change the unit's data; condition values are reported with updateCondition, second life with createSecondLifeBattery.

Autorisierung

apiKey
headerAutorisierungBearer <Token>

Organisation API key sent as Authorization: Bearer bp_live_… (ADR-017). Accepted only by the operations that list this scheme, with the scope in their x-api-key-scope.

Pfad-Parameter

batteryId*string
Formatuuid

Request-Body

application/json
  1. body
description?string
Längelength <= 2000
evidence_ids?array<>
Elementeitems <= 20
occurred_on*string
Formatdate
type*ReportedEventType

The event types members and service partners report.

Wert in"placed_on_market""put_into_service""inspection""repair""component_replaced""condition_update""waste""recycled""custom"

Antwort-Body

The event.

application/json
  1. response
api_key?

An organisation API key (ADR-017) that reported an event (source api) or staged an import (ADR-026).

battery_id*string
Formatuuid
created_at*string
Formatdate-time
description?string
evidence*array<>
field_keys*array<>

The condition fields this event updated.

id*string
Formatuuid
occurred_on*string
Formatdate
partner?
related_battery_id?string

Second life: the successor (on the predecessor's event) or the predecessor (on the successor's).

Formatuuid
related_serial_number?string
reported_by?
source*EventSource

manual (a member), supplier (a service-partner link), api (an API key, M7), system.

Wert in"manual""supplier""api""system"
type*LifecycleEventType

What happened to a unit. condition_update is recorded by condition updates, repurposed, reused and remanufactured by createSecondLifeBattery; the others are reported.

Wert in"placed_on_market""put_into_service""inspection""repair""component_replaced""condition_update""repurposed""reused""remanufactured""waste""recycled""custom"
Beispielanfrage
curl -X POST 'https://example.com/api/v1/batteries/497f6eca-6276-4993-bfeb-53cbbbba6f08/lifecycle-events' \  -H 'Content-Type: application/json' \  -d '{  "occurred_on": "2019-08-24",  "type": "placed_on_market"}'
Beispielantwort
{  "api_key": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string"  },  "battery_id": "bf9efcd2-a647-473f-b459-71d521ebe1ad",  "created_at": "2019-08-24T14:15:22Z",  "description": "string",  "evidence": [    {      "access_tier": "public",      "filename": "string",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "kind": "declaration_of_conformity",      "revision": 1,      "superseded": true,      "title": "string"    }  ],  "field_keys": [    "string"  ],  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "occurred_on": "2019-08-24",  "partner": {    "email": "user@example.com",    "name": "string",    "request_id": "266ea41d-adf5-480b-af50-15b940c2b846"  },  "related_battery_id": "1ce5ea42-7c27-4051-b607-ecc81b42bedf",  "related_serial_number": "string",  "reported_by": {    "display_name": "string",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"  },  "source": "manual",  "type": "placed_on_market"}