Below is an example of a script for simple monitoring, pressing 1 or 2 to send OK or Failure.

The purpose of this example is only to demonstrate how calls should be made to the webhook monitoring created by 1P.

The script collects the data in your application or dependency, interprets the result and delivers it to 1P according to the instructions in the “Hits and Failures” box presented on the page of your registered application in OnePlatform.



echo "Failure ou OK?"
echo "1. Failure"
echo "2. OK"
read status
echo "-------------"

token=`curl --request POST \
--url<Your Company URL> \
--header 'Content-Type: application/json' \
--data '{
"client_id": "<YOUR INFORMATION HERE>",
"client_secret": "<YOUR INFORMATION HERE>" }' | sed 's/{"access_token":"//g' | sed 's/","expires_in":300,"token_type":"Bearer"}//g'`

if [ $status == 2 ]; then
echo "OK"
curl -X POST -H 'Content-type: application/json' -H "Authorization: Bearer $token " --data '{"latency": 100000, "service": <YOUR SERVICE ID HERE>, "organization": "<YOUR ORGANIZATION ID HERE>"}'

if [ $status == 1 ]; then
echo "Failure"
curl -X POST -H 'Content-type: application/json' -H "Authorization: Bearer $token " --data '{"issue": "<Your message>", "service": <YOUR SERVICE ID HERE>,"organization": "<YOUR ORGANIZATION ID HERE>"}'
Did this answer your question?