UWAGA: poniższa dokumentacja dotyczy nieakutalnej wersji API (2.0.0). Kliknij aby przejść do aktualnej dokumentacji.

<<

Migrating from API1 to API2

This document contains some hints about moving from API1 to the new API.

API1 documentation (in Polish) can be found at https://develapi.cloudmonit.pl/doc/client/ (for clients) and https://develapi.cloudmonit.pl/doc/partner/ (for partners).

Naming conventions

Identifiers

Most objects in the old API had different identifier names. For example, services were identified by sids and groups by gids. In API2, objects are identified by their id. When there is a need to specify a identifier to an object of a different type (for example, specifying a group when creating a service), a long name such as group_id or service_id is used.

Methods

Several API1 modules included "Get" and "List" methods. Their equivalents in API2 are called "Read" and "Find".

Methods "ListBy*ids" (such as Service::ListBySids) are not supported. However, you can use the Find's features to get simple filtering or pagination of the results.

Other

Sensors have been renamed to locations in API2.

Service checks (in Client::HAR) are now called iterations and have a slightly different identifier format.

Authentication

To authenticate to API2, you supply a login and password. If you have a regular Monit24.pl account, you can simply use the same login and password that you use for authentication to the Administration Panel.

If you used the old Client API, you authenticated using a UID and API password. You can use your UID as the login and old API password as password to authenticate to API2. Keep in mind that this method will be removed in the future, you should use your login and password.

Most methods in the old Partner API required an UUID and password (called "hash"). You can use these to login to the user's old account with new API (UUID becomes login, hash - password). Some Partner API methods (such as Partner::User::Create) required partner authentication with "vendor_id" and "vendor_hash". To authenticate as a partner, you will need a new Distributor account. Please contact the Monit24.pl support if you would like to have the old users assigned to the new account.

Managing user accounts (partners only)

To create a new account (previously Partner::User::Create), use the Account::Create method (you need to be a distributor) and then activate the account with Account::Activate. Instead of supplying a hash and uuid, you set the new user's login (it may still be an UUID if you like) and password. Used created by API2 cannot be accessed by the API1 methods.

To delete an user, use the Account::Delete method. Only distributors/partners can do this.

The Service module

Creating and updating the services

Creating a service used to be done with one of the methods: CreateHttp, CreateHttps, CreatePing or CreateSmtp. In API2, you create a service with the Service::Create method. The API2 method arguments include:

Similarly, there is only one method for updating a service, Service::Update.

Enabling and disabling the monitoring

API1 had separate methods to pause and unpause a service's monitoring (Enable and Disable). In API2, you should use the Service::Update method to set the service's pause attribute to either 1 or 0.

Other modules

The API2 Stats module contains most of the statistics methods ported from the old API.

Client::Notification and Partner::Notification are now handled by the NotificationAddress module.

For Client::Report and Partner::Report's equivalent - see ReportAddress.

HAR files

The equivalents of the old Client::HAR module's methods can be found in the Stats module. You can get a list of HAR files for a service (from time period not longer than one hour) with the Stats::HARList method, and fetch individual HAR files with the Stats::HARContent method.

Incompatibilities and limitations

In general it is not recommended to use API1 methods after you have modified anything with API2 methods. Known limitations include deleting an account with the old API's Partner::User::Delete method, the account may not get deleted after it's been modified with API2.

<<