curl --header "Authorization: Bearer ${TFE_TOKEN}" --header "Content-Type: application/vnd.api+json" $TFE_ADDR/api/v2/organizations/$TFE_ORG/workspaces | jq .
You can have the above in a loop, or to get a specific workspace:
# id of the first workspace returned
| jq .data[0].id
# Name of the first workspace returned
| jq .data[0].attributes.name
# Create a payload file with WORKSPACE_ID
# payload.json
{
"data": {
"attributes": {
"is-destroy":false
},
"type":"runs",
"relationships": {
"workspace": {
"data": {
"type": "workspaces",
"id": "workspace-id"
}
}
}
}
}
curl --header "Authorization: Bearer ${TFE_TOKEN}" --header "Content-Type: application/vnd.api+json" --data @payload.json https://${TFE_ADDR}/api/v2/runs