1

Not able to execute Any API's Successfully

Topic: Not able to execute Any API's Successfully

I tried executing the following api using postman 
https://hst-api.wialon.com/wialon/ajax.html?svc=core/login&params={"user":<text>,
               "password":<text>,
               "operateAs":<text>}

This returns 200 status with message error 7.

https://hst-api.wialon.com/wialon/ajax.html?svc=core/get_account_data&params={"type":1}
it returns 200 status with message error 1.

Is this the correct methods to call api ? Do we required any extra parms other then what is mentioned in document below.
https://sdk.wialon.com/wiki/en/sidebar/ … core/login


We are not able to execute any api. Please suggest or a sample api execution would be very very helpful

Thanks and any help would be highly appriciated

2

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

satyam87 wrote:

I tried executing the following api using postman
https://hst-api.wialon.com/wialon/ajax.html?svc=core/login&params={"user":<text>,
               "password":<text>,
               "operateAs":<text>}

This returns 200 status with message error 7.

https://hst-api.wialon.com/wialon/ajax.html?svc=core/get_account_data&params={"type":1}
it returns 200 status with message error 1.

Is this the correct methods to call api ? Do we required any extra parms other then what is mentioned in document below.
https://sdk.wialon.com/wiki/en/sidebar/ … core/login

We are not able to execute any api. Please suggest or a sample api execution would be very very helpful

Thanks and any help would be highly appriciated

The method you mentioned and tried to login with is old method which no longer available (it's mentioned in this method documentation page).
You should use New authorization way which you can find it in documentation and here is forum discussion about that:
https://forum.gurtam.com/viewtopic.php?id=7875

3

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Thanks, So can we call any other api after we login by the new form mention in the link  https://forum.gurtam.com/viewtopic.php?id=7875
Can you post one example which can be posted into postman and executed.

4

Not able to execute Any API's Successfully

(edited by satyam87 15/04/2019 20:23:33)

Re: Not able to execute Any API's Successfully

I am getting
{
    "error": 1
}
When calling this api
https://hst-api.wialon.com/wialon/ajax. … p;params={
        "id":34868,
        "flags":1025
    }&sid=412600aec695f5d02aa26c7d683ea274


can you help me with this, thanks

5

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Please take a look at https://sdk.wialon.com/wiki/en/sidebar/ … ors/errors
Your session has expired and you have to login again and get new sid and try to execute commands with new sid.

6

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Just to expand on that too, if I remember correctly sessions last 5 minutes after the last request made with that session id, so you will want to log in and then immediately follow that up with a request using the returned session id while you're testing in postman.

7

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Can you post one example which can be posted into postman and executed.

8

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

satyam87 wrote:

Can you post one example which can be posted into postman and executed.

Just exported from postman, Import collection and try to send Search_item request from it
{{SID}} and {{ITEM_ID}} are environment variables, set before testing

Post's attachments

Attachment icon Wialon.postman_collection.json 1.03 kb, 611 downloads since 2019-04-17 

9

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Thanks, Most of the api I execute the postman response error 1
Can you please suggest why ?? What may be the issue
Below is the one example of api

https://hst-api.wialon.com/wialon/ajax.html?svc=core/get_account_data&params={"type":1}

10

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Missing sid parameter (Session ID)

11

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Hi

Can you please help me with is api

https://hst-api.wialon.com/wialon/ajax. … chart&
    params={
        "attachmentIndex":0,
        "action":0,
        "width":600,
        "height":300,
        "autoScaleY":0,
        "pixelFrom":0,
        "pixelTo":300,
        "flags":513
    }&sid=41364cc1e803095e9e8f6a879e9a119b


This give error 3


https://hst-api.wialon.com/wialon/ajax. … eport&
    params={
        "reportResourceId":163266,
        "reportTemplateId":10,
        "reportObjectId":34868,
        "reportObjectSecId":0,
        "interval":{
            "from":1357938000,
            "to":1358715599,
            "flags":0
        }
    }&sid=41364cc1e803095e9e8f6a879e9a119b

Thia gives error 7

12

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Hello satyam87 !

1. Before you get chart result you need to execute request exec_report to upload report with chart. After you can execute report/get_result_chart to get chart. Without report executed you will get Error 3
Please look example here how to work with reports
2. there are not such ID = 163266 for element resource, ID = 34868 for unit. Please check ID for required elements. After you login you can get available elements for your user with their ID. Also you can find required elements (resource, unit and etc ) and get their ID by request Search items by property

Diana Cheley
Wialon Hosting Expert
Gurtam
13

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Hi
I am posting
https://hst-api.wialon.us/wialon/ajax.html?svc=report/get_result_rows&params={"tableIndex":0,"indexFrom":0,"indexTo":10}&sid=41f92e5beaaf27eb88a5220e24f64a46

But it throws

{
    "error": 5
}
Error performing request

Can you help me where I am making mistake ??

14

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

I have execute request exec_report to upload report but getting
{
    "error": 7
}

https://hst-api.wialon.com/wialon/ajax. … eport&
    params={
        "reportResourceId":163266,
        "reportTemplateId":10,
        "reportObjectId":34868,
        "reportObjectSecId":0,
        "interval":{
            "from":1357938000,
            "to":1358715599,
            "flags":0
        }
    }&sid=41107f69a4a540132302fc78e37598fc

15

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

I did same as given in examle
https://sdk.wialon.com/wiki/en/sidebar/ … es/reports

With my sid

16

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

When I am calling this api to get bonded driver with unit this throws error
{
    "error": 4,
    "reason": "VALIDATE_PARAMS_ERROR: {unitId: long}"
}

https://hst-api.wialon.com/wialon/ajax.html?svc=resource/get_unit_drivers&params={"id":400002818}&sid=41b5da9070a5ecb744f1f08be0c73990

17

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

Hello!
1. Before you get report result via request report/get_result_rows you need to execute request exec_report to upload report with table data. After you can execute report/get_result_rows to get data from tables. Without report executed you will get Error 5
Please look example here how to work with reports
2. there are not such ID = 163266 for element resource, ID = 34868 for unit. That is why you get error7
Please check ID for required elements.
After you login you can get available elements for your user with their ID. Also you can find required elements (resource, unit and etc ) and get their ID by request Search items by property

Diana Cheley
Wialon Hosting Expert
Gurtam
18

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

When I am calling this api to get bonded driver with unit this throws error
{
    "error": 4,
    "reason": "VALIDATE_PARAMS_ERROR: {unitId: long}"
}

https://hst-api.wialon.com/wialon/ajax.html?svc=resource/get_unit_drivers&params={"id":400002818}&sid=41b5da9070a5ecb744f1f08be0c73990

19

Not able to execute Any API's Successfully

Re: Not able to execute Any API's Successfully

satyam87

Try replacing the "id" param with "unitId" as described in the docs:
https://sdk.wialon.com/wiki/en/sidebar/ … it_drivers