What are the ways to create credentials and get the created credentials in sandbox environment?
Hi @demoprod!
To create a credential you have to make a POST to /credentials for the respective site.
For example: In ACME site Normal (id_site: 56cf5728784806f72b8b4568) there are two credentials: username & password. You can find the credentials needed for a specific site looking at the “credentials” field in a site like this:
{
"id_site": "56cf5728784806f72b8b4568",
"id_site_organization": "56cf4ff5784806152c8b4567",
"id_site_organization_type": "56cf4f5b784806cf028b4568",
"id_site_type": "5b285177056f2911c13dbce1",
"is_business": 1,
"is_personal": 1,
"version": 1,
"name": "Normal",
"credentials": [
{
"name": "username",
"type": "text",
"label": "Username",
"required": true,
"username": true,
"token": false,
"validation": null
},
{
"name": "password",
"type": "password",
"label": "Password",
"required": true,
"username": false,
"token": false,
"validation": null
}
],
"endpoint": "/v1/credentials"
}
You can get all the sites in Sandbox from GET to /catalogues/sites, so for this example your POST to /credentials should be like this:
curl --location --request POST 'https://sync.paybook.com/v1/credentials' \
--header 'Content-Type: application/json' \
--data-raw '{"id_site": "56cf5728784806f72b8b4568", "credentials": {"username": "test", "password": "test"}, "token": "<YOUR_TOKEN>"}'
In order to get the created credentials you have to send a GET to /credentials and add the token as Authorization:
curl --location --request GET 'https://sync.paybook.com/v1/credentials' \
--header 'Authorization: Bearer <YOUR_TOKEN' \