Manage resources
This guide shows the most common management operations. Before you start, obtain a token as described in Authentication and set the variables:
API_BASE='https://api.exemplo.com:33070'
ACCESS_TOKEN='<access_token>'The contract of every endpoint is in the OpenAPI specification and the conventions in Management resources.
List the instances
curl -s "$API_BASE/stcpcore/v2/instances" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Accept: application/json'Note the instance ID. The response carries the instances the operator’s groups can access.
Get an existing user
curl -s "$API_BASE/stcpcore/v2/instances/id/<instanceID>/users" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Accept: application/json'Save a user similar to the one you will create, for example in user.json. It serves as a template for CONFIG_TXT. The fields and coded values are in CONFIG_TXT structure.
Create the user
In the file, remove the ID field, change NAME and the required CONFIG_TXT fields, and send:
curl -s -X POST "$API_BASE/stcpcore/v2/instances/id/<instanceID>/users" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data @user.jsonResponse:
{"data": "PARTNER02", "field": "user"}Important
The header must be exactly Content-Type: application/json. With any other value, including with charset, the API responds 400.
Update or delete
To update, send the complete entity with PUT on the user path. The CONFIG_TXT sent replaces the stored one entirely: always start from a current query. Masked fields (****) keep the stored value.
curl -s -X PUT "$API_BASE/stcpcore/v2/instances/id/<instanceID>/users/id/<userID>" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data @user.json
curl -s -X DELETE "$API_BASE/stcpcore/v2/instances/id/<instanceID>/users/id/<userID>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Create the mailbox and test the connection
With the user created, use supervision to create the mailbox directory structure and start an outbound connection:
curl -s -X POST "$API_BASE/stcpadminsvc/v2/supervision/stcpmon/user/create_folder" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"Instance": "STCPGEMINI", "Name": "PARTNER02"}'
curl -s -X POST "$API_BASE/stcpadminsvc/v2/supervision/stcpmon/user/start" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"Instance": "STCPGEMINI", "Name": "PARTNER02"}'The commands require the supervision services to be registered. See Supervision services.
Other tasks
| Task | Endpoint |
|---|---|
| Unlock a user | POST /stcpadminsvc/v2/supervision/stcpauth/reset/user/lock with {"Instance": "...", "Name": "..."} |
| Reset a user’s password | POST /stcpadminsvc/v2/supervision/stcpauth/reset/user/password with NewPassword |
| Run a schedule right away | POST /stcpadminsvc/v2/supervision/stcpmon/schedule/start with {"Instance": "...", "Name": "<schedule>"} |
| Test a file name against the file types | GET /stcpcore/v2/instances/id/{instanceID}/ftypesglobal/check?filename=<name> |