Hello, I am trying to use API and it is not working. First I am making Api call to LOGIN and it seems that I am getting some success. I am getting answer:
{"success":true,"permissions":["ADS.*","Instances.*","Settings.*","FileManager.*","LocalFileBackup.*","Core.*"],"sessionID":"9483eb88-fb6a-41c0-8dce-6ec17776fba4","rememberMeToken":"932ad6fd-d541-4718-93e3-651d458f610e","userInfo":{"ID":"b2fc3445-db2f-4f54-a6f4-54167ed789ef","Username":"zabbix","IsTwoFactorEnabled":false,"Disabled":false,"LastLogin":"\/Date(1600622697338)\/","GravatarHash":"5fcd1b3e34b52fffef0037ce08c7cd66"},"result":10}
But when I want to make any other call, for instance to GetLocalInstances I get the following reply:
{"Error":true,"Title":"Unauthorized Access","Message":"You do not have permission to use this method (WebMethods.GetAMPUsersSummary) at this time. This method requires the Session.Exists permission.","StackTrace":"\n at GSMyAdmin.WebServer.WebAttributes.InvokeMethod (String MethodName, Newtonsoft.Json.Linq.JObject Data, m.Http.IHttpRequest request, ModuleShared.IWebSession Session, ModuleShared.WebMethodsBase MethodsClass, String RawRequest) \n at GSMyAdmin.WebServer.APIService.InvokeAPI (m.Http.IHttpRequest request, ModuleShared.IWebSession Session, Newtonsoft.Json.Linq.JObject Data, String RequestModule, String RequestMethod, String RawRequest) "}
To the second call I am passing the whole answer from the first call. Herre is my call (bash script):
RESPONSE=$( curl \
--header "Accept: application/json" \
--request POST \
--data "$TOKEN" \
http://minecraft.mydomain.pl.:8080/API/Core/GetAMPUsersSummary )
The $TOKEN is replaced by the response from the first 'login' call, which is in fact almost identical, only theurl is different and json is taken from article on using the API. In audit logs I do see that the user zabbix is correctly logged in. User zabbix is added to super-admins group so it should have ALL permissions. the API documentation is very poor. Only a short article without any examples. The description of the keys is not helping either (only key name and very very short listing of available parameters without even one sentence what it does.