Trying to walk through a new service via API

Hello! I am pretty new to Icinga and Nagios and trying to understand the API calls to do the basic stuff. I find the documentation hard to understand and re the API there is not really enough concrete examples so I could understand fully, and I feel pretty stuck by now. I hope you can help me put together the few most basic commands.

So in Icinga there already exist all the machines. I was able to activate a certain, already existing service to one machine via:

curl -k -s -u USER:PW -H ‘Accept: application/json’
-X PUT ‘SERVER:PORT/v1/objects/services/HOST!realtime-load’
-d ‘{ “templates”: [ “generic-service” ], “attrs”: { “check_command”: “load”, “check_interval”: 1,“retry_interval”: 1 } }’

But what I would like to do is the whole process of having a custom script, from which I want to build a check command, and then from that create a service on a machine. I tried the following as a simple example, but it always returns unhandled exceptions:

curl -k -s -u USER:PW -H ‘Accept: application/json’
-X PUT ‘SERVER:PORT/v1/objects/checkcommands/mytest’
-d ‘{ “templates”: [ “plugin-check-command” ], “attrs”: { “command”: [ “unused_kernels” ] } }’

Also I am not sure how to tell the API if the custom script is only locally on my client machine, or if it is installed on the Icinga satellite/master.

So yeah, any newbie help would be greatly appreciated.