Skip to content

Add an example using curl #495

Description

@Ernst2020

Current Situation

I wonder why no example using curl is provided.

I found this (at https://libraries.io/npm/homebridge-switchbot-discomfort-index):

TOKEN="..."
SECRET="..."
T=$(date +%s%3N)
NONCE=$(uuidgen)
SIGN=$(echo -n "${TOKEN}${T}${NONCE}" | openssl dgst -sha256 -hmac "${SECRET}" -binary | base64)

curl -s https://api.switch-bot.com/v1.1/devices
-H "Authorization: ${TOKEN}"
-H "sign: ${SIGN}"
-H "t: ${T}"
-H "nonce: ${NONCE}" | jq

Works great.

Note: uuidgen is part of the uuid-runtime package.

Proposed Change

Add a curl example, preferably also for Windows environments.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions