Created
November 18, 2022 23:55
-
-
Save stephenlb/d56b739389feed8c7a320035599b0b9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
export SPACE_ID="hexgrid-id-6789x3845" | |
export SPACE_NAME="Queensland" | |
export USER_ID="michael-12345" | |
export USER_NAME="Michael" | |
export ASSET_ID="$USER_ID-asset-drone-1" | |
export SUBSCRIBE_KEY="demo" ## use 'demo' key for testing | |
## User Create | |
curl -s -X PUT -d '{"name":"'$USER_NAME'", "status":"offline", "custom":{"assets":["'$ASSET_ID'"]}}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/users/$USER_ID | |
## User Update | |
curl -s -X PATCH -d '{"status":"online"}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/users/$USER_ID | |
## User Fetch | |
curl -s https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/users/$USER_ID | |
## Space Create | |
curl -s -X PUT -d '{"name":"'$SPACE_NAME'", "status":"acitive", "custom":{}}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/spaces/$SPACE_ID | |
## Members of Spaces | |
curl -s -X PUT -d '{"status":"online"}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/memberships/spaces/$SPACE_ID/users/$USER_ID | |
curl -s -X PUT -d '{"status":"online"}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/memberships/spaces/$SPACE_ID/users/$ASSET_ID | |
## Get Members of a Space | |
curl -s https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/memberships/spaces/$SPACE_ID |
Author
stephenlb
commented
Nov 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment