1

How to get the POIs using the Remote API?

Тема: How to get the POIs using the Remote API?

Hello again,

I'm trying to get the list of POIs from my site via the Remote API, using my user/password.

Again, I have found no example in the API documentation, but after reading the code of the page of my site, I guessed the POIs are resources (or so I think), so started using the "avl_resource" type. The call I'm making looks like this (it's in C#):

       private static string WialonGetPOIs(string sid)
        {
            string urlGetPOIs =
                "http://hosting.wialon.com/wialon/ajax.html?svc=core/update_data_flags&sid=" + sid +
                "&params={" +
                    "\"spec\":[" +                    /* array of requests to the server */
                    "{" +
                        "\"type\":\"type\"," +        /* get objects by type */
                        "\"data\":\"avl_resource\"," +    /* type is set to "avl_resource" (does that get the POIs?) */
                        "\"flags\":1," +            /* get common information */
                        "\"mode\":0" +                /* set flags */
                    "}" +
                    "]" +
                "}";
 
            return (new WebClient()).DownloadString(urlGetPOIs);
        }

With that call I do get some results, but they seem weird. Firstly, there's only one element in the returned JSON string, while I have four POIs in my site. Also, the resource I'm getting is visibly none of the POIs registered in my site, as the returned name is totally different. I experimented with some flag values, quite blindly, but nothing helpful came out this far.

So, can you please help me to get the list of POIs and their positions using the Remote API?

Thanks in advance!

2

How to get the POIs using the Remote API?

Re: How to get the POIs using the Remote API?

zorrow, POIs are contained in resources, so you need to search for avl_resource items and request data flags with bit 0×00000800, e.g. flags=0×00000801 in your sample request above. Then per each returned resource you will have collection of POIs with base information in it. To get more POI information you can use http://docs.gurtam.com/en/hosting/sdk/w … t_poi_data method (next step).

At the dark side of telematics...
3

How to get the POIs using the Remote API?

Re: How to get the POIs using the Remote API?

Hi Shal,

in the example above of Zorrow, why you told him to use flags=0×00000801 instead  of 0×00000800  ?

Can you show me and add correction as necessary at the right place in the script of Zorro to have as return from the API , all informations of all POI we have for this specific account. That we help us to debug this issue ! and to pass to the next step.

Thanks a lot.

private static string WialonGetPOIs(string sid)
        {
            string urlGetPOIs =
                "http://hosting.wialon.com/wialon/ajax.h … s&sid=" + sid +
                "&params={" +
                    "\"spec\":[" +                    /* array of requests to the server */
                    "{" +
                        "\"type\":\"type\"," +        /* get objects by type */
                        "\"data\":\"avl_resource\"," +    /* type is set to "avl_resource" (does that get the POIs?) */
                        "\"flags\":1," +            /* get common information */
                        "\"mode\":0" +                /* set flags */
                    "}" +
                    "]" +
                "}";

            return (new WebClient()).DownloadString(urlGetPOIs);
        }

4

How to get the POIs using the Remote API?

Re: How to get the POIs using the Remote API?

NTS пишет:

in the example above of Zorrow, why you told him to use flags=0×00000801 instead  of 0×00000800

Hi NTS, it is 0x1 /BASE/ + 0x800 /POI/

At the dark side of telematics...
5

How to get the POIs using the Remote API?

Re: How to get the POIs using the Remote API?

Hi Shal,

About this script would you tell me what we need to add to received all POI and all informations for those POI :

We have tried few things wiht out success !

Thanks

private static string WialonGetPOIs(string sid)
        {
            string urlGetPOIs =
                "http://hosting.wialon.com/wialon/ajax.h … s&sid=" + sid +
                "&params={" +
                    "\"spec\":[" +                    /* array of requests to the server */
                    "{" +
                        "\"type\":\"type\"," +        /* get objects by type */
                        "\"data\":\"avl_resource\"," +    /* type is set to "avl_resource" (does that get the POIs?) */
                        "\"flags\":1," +            /* get common information */
                        "\"mode\":0" +                /* set flags */
                    "}" +
                    "]" +
                "}";

            return (new WebClient()).DownloadString(urlGetPOIs);
        }

6

How to get the POIs using the Remote API?

Re: How to get the POIs using the Remote API?

I tried the 0x801 flag. It works! It's also returning all the names and positions for the POIs, so I get all what I want in just one shot.

The returned string is however kind of weird, as I was expecting an array of POIs, but it's actually just one element with a comma-separated string member containing all the POIs. I will have to parse it my side, but that's no big deal.

In any case, this unblocks me big time as I got all what I wanted.

Huge thanks!