Service ProfilesUpdate device-to-device mode of a service profile

Update device-to-device mode of a service profile

<Info icon="fa-light fa-lock" className="permission-callout"> <div className="permission-callout__header"><span className="permission-callout__title"><span className="permission-callout__label">Required permissions</span> <span className="fern-docs-badge small blue subtle rounded-full permission-callout__beta">Beta</span></span> <span className="permission-callout__learn-more">[Learn more](/developers/api-guidelines/permissions#how-permissions-work)</span></div> `ServiceProfile.D2d` + `Update` <div className="permission-callout__roles"><span className="permission-callout__roles-label">Roles:</span> <Badge intent="info">Administrator</Badge></div> </Info> Sets the device-to-device (D2D) mode of a service profile. The response returns the updated configuration, so there's no need for a follow-up `GET` request. For devices to communicate, enable device-to-device on the service profile of every device involved. If only one side is enabled, return traffic is blocked. Devices must belong to the same organization and region. Communication across organizations or regions isn't supported. Setting `enabled` or `forward_to_backend` requires your organization to have a virtual network. Setting `disabled` doesn't require a virtual network. Changes take effect without devices reconnecting. <Warning> `forward_to_backend` only prepares the configuration. It requires a default route over [Cloud Connect](/services/cloud-connect), and OpenVPN isn't supported. The API accepts the mode without checking your Cloud Connect configuration and returns a warning instead. Traffic between devices is dropped until the setup is complete. </Warning> <Note> Device-to-device is opt-in and enabled per organization. Until it's enabled for your organization, requests return `403`. To request access, contact emnify support. </Note>

Authentication

AuthorizationBearer

An auth_token should be provided to authenticate a session.

To obtain an auth_token, see the /api/v1/authenticate POST request.

Path parameters

service_profile_idintegerRequired
The numeric ID of a service profile.

Query parameters

org_idlongOptional

Numeric ID of a child organization to act on. Omit to use your own organization. Returns 403 if the organization isn’t a child of yours. The service profile must belong to that organization, and device-to-device must be enabled for it.

Request

This endpoint expects an object.
modeenumRequired

Device-to-device mode to set. The value is case-insensitive.

Allowed values:

Response

Device-to-device mode updated.

service_profile_idinteger
ID of the service profile.
modeenum

Device-to-device mode of the service profile:

  • disabled (default): Traffic between devices is dropped.
  • enabled: Traffic is delivered directly between devices, as long as the service profiles of both devices have device-to-device enabled.
  • forward_to_backend: Traffic between devices is routed through your Cloud Connect backend, for example so your own firewall can inspect it.
Allowed values:
modified_atstring or nullformat: "date-time"

When the mode was last changed. null if device-to-device has never been configured on the service profile.

warningslist of stringsOptional

Advisory messages about the configuration. Only present in PUT responses, and only when there’s something to report, for example after setting forward_to_backend.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
503
Service Unavailable Error