Skip to main content

Create device

Motivation​

Create(register) a new device

Functional design​

POST /api/v2/apps/{owner}/{app}/devices

Headers​

KeyValue
AuthorizationBearer {principalToken}
Content-Typeapplication/json

Parameters​

ParameterTypeDescription
ownerstringname of a user who owns the application
appstringname of an application

Result​

CodeDescriptionBody
201Created, see response below
400Bad Requesterror object
401Unauthorizederror object
403Forbiddenerror object
429Too may requests, rate limitingerror object
500+Server errors / service unavailableerror object

Response example 201:

{
"login": "{generated-login}",
"password": "{generated-password}"
}

To fetch the WSID of a profile, the caller should use the /auth/login endpoint with the generated login and password.

Technical design​

Components​

  • pkg/router
    • URL path handler ~cmp.routerDevicesCreatePathHandler~covrd1✅:
      • parses the request Body
      • generates, login, password and pseudo-wsid
      • sends v2 request c.registry.CreateLogin to Command Processor
      • handles the response and replies with the login and Password
  • pkg/sys/it
    • integration test for /users
      • ~it.TestDevicesCreate~covrd2✅

Footnotes​

  1. [~server.devices/cmp.routerDevicesCreatePathHandler~impl] pkg/router/impl_apiv2.go:425:impl ↩

  2. [~server.devices/it.TestDevicesCreate~impl] pkg/sys/it/impl_signupin_test.go:201:impl ↩