JavaScript
const options = { method: 'PUT', headers: { 'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: '<string>', address: '<string>', country: '<string>', type: '<string>', categories: {}, cups_list: {}, status: '<string>', logistic_factor: 123 }) }; fetch('https://api.dcycle.io/v1/facilities/{facility_id}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
Modify an existing facility’s details
status
archived
550e8400-e29b-41d4-a716-446655440000
active
curl -X PUT "https://api.dcycle.io/v1/facilities/550e8400-e29b-41d4-a716-446655440000" \ -H "x-api-key: ${DCYCLE_API_KEY}" \ -H "x-organization-id: ${DCYCLE_ORG_ID}" \ -H "Content-Type: application/json" \ -d '{ "name": "Madrid HQ", "categories": ["heat", "electricity", "water", "recharge"] }'
{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Madrid HQ", "type": "office", "country": "ES", "address": "Calle Gran Vía 1, Madrid", "status": "active", "co2e": 1250.5, "co2e_biomass": 0.0, "logistic_factor": 0.8, "categories": ["heat", "electricity", "water", "recharge"], "cups_list": ["ES0021000000000001AA"], "facility_purpose_type": "facilities", "created_at": "2024-11-24T10:30:00Z", "updated_at": "2024-12-01T15:45:00Z" }