Act on a port
POST
/api/v1/port/{port}
const url = 'http://pwrman.local/api/v1/port/1';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"action":"disable"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://pwrman.local/api/v1/port/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "action": "disable" }'enable and disable switch the port on and off. A port set to
last in port_boot comes back in the state set here after a
restart. hard_reset sends a USB PD hard reset, src_cap announces
the port’s power offers to the device again, and update writes the
bundled firmware to the port’s blade now.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”port
required
integer
Port number.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
action
required
string
Example
{ "action": "disable"}Responses
Section titled “Responses”Done.
Media typeapplication/json
object
ok
required
boolean
Example
{ "ok": true}The action is not one of the above.
Media typeapplication/json
object
error
required
Why the request was refused, in words.
string
Example
{ "error": "unknown action"}The token is missing or wrong, or no token is set yet.
Media typeapplication/json
object
error
required
Why the request was refused, in words.
string
Examples
{ "error": "bearer token required"}{ "error": "no API token set yet: finish first-time setup first"}No such port or path.
Media typeapplication/json
object
error
required
Why the request was refused, in words.
string
Example
{ "error": "no such endpoint"}The controller is busy with another request. Try again.
Media typeapplication/json
object
error
required
Why the request was refused, in words.
string
Example
{ "error": "busy, retry"}USB Type-C® and USB-C® are registered trademarks of USB Implementers Forum.