Usage Examples
Examples of using both internal and external API services are given below.
You can use Postman to easily test WISECP APIs. You can use the link below to access code samples and quick testing.
Postman allows you to quickly validate and test your APIs, so you can move your integration process forward smoothly.
External API Example
curl --location 'https://example.com/api/Clients/ValidateClient' \
--header 'Content-Type: application/json' \
--header 'Apikey: [YOUR_API_KEY]' \
--data-raw '{
"email": "[email protected]",
"password": "test123"
}'
Response (JSON)
{
"status": "successful",
"data": {
"user_id": 19,
"hash": "ZmozNFdUNy8wMGM4bkVKK01IeUF5d2tSNzU0d1E1VThLZUJmZXNzdVNkK2dvWEgwdmdOTDE4YldmMzFCTVdheVY3bjhRTDBxSVNOb1FXcjBhVEhiTlE9PQ=="
}
}
Internal API Example
<?php
Helper::Load("Api");
try {
$result = Api::Clients()->CreateClientSsoToken([
"email" => "[email protected]",
"password" => "test123"
]);
if($result["status"] == "error") throw new Exception($result["message"]);
echo $result["data"]["user_id"];
}
catch (Exception $e)
{
echo 'Error: '.$e->getMessage();
}
Response
Array
(
[status] => successful
[data] => Array
(
[user_id] => 22
[hash] => TEtzRzkyUy84N2habVlEQWVUNHhhL0pvRUd0ZVMrMXpQVmVKUTlid2Rac1h5NGJ5L2E0RzhLV082T2EvM1RRbmNmUVVJcFdoT093eExsaWlORERyV1E9PQ==
)
)