Testing check mk API in Postman

Hello everybody,

I am new to checkmk. I am testing the API currently. I want to test it in POSTMAN.
I have a question regarding HTTP request GET.

Say for example that i want to get all hosts display name. I know i need to authenticate. Can someone provide me with an exemple ?

Or where to put the user/password in postman ?

Thanks a lot !

UPDATE : I have succesully managed to get a result wit this GET command in postman.

http://myserver_IP/myservername/check_mk/webapi.py?action=get_all_hosts&_username=automation&_secret=mysecretkey.

All the API documentation mentions is about cURL syntax in a linux system terminal.

My questions are :

  1. I need to be able to query using the URL structure described just above by changing the actions parameters ( in this exemple it would be action=get_all_hosts). Is there a list of these parameters.

  2. If not, where can i find ressources to guide me to tranform curl syntax into the structure like the one above ?

Thanks you for your answers.

What you used is not the REST api. It is the “old” webapi.
Here is a very brief example Postman collection with a “get all hosts” request.

{
	"info": {
		"name": "CMK Rest API",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Get all Hosts",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "http://monitoringhost/sitename/check_mk/api/1.0/domain-types/host_config/collections/all",
					"protocol": "http",
					"host": [
						"monitoringhost",
					],
					"path": [
						"sitename",
						"check_mk",
						"api",
						"1.0",
						"domain-types",
						"host_config",
						"collections",
						"all"
					]
				}
			},
			"response": []
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "automation automationsecret",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	]
}

Documentation an REST api gui can be found here.
image

1 Like

Thank you for your answer Andreas. Is the web api deprecated ? Beside get all host request, are there other request that I can make using the same structure ?

Not directly. At the moment is the web api the only way to get rulesets.

Take a look the linked interactive GUI. There you find alle requests you can make.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.