Baidu Map Eagle Eye Trajectory Service Web Service API application

Source: Internet
Author: User
1. Enter the console to enter the application, preferably certified Baidu Developer, no certification, code no problem has been reported 4005 errors

Create App Address: Http://lbsyun.baidu.com/apiconsole/key
2. Create Eagle Eye Service

Create Eagle Eye Service address: Http://lbsyun.baidu.com/trace/admin/service
3. Terminal management (Create, change, delete, query all terminals)

Interface Description Address: http://lbsyun.baidu.com/index.php?title=yingyan/api/v3/entity
Create a terminal

Package Yingyan;
Import java.io.IOException;
Import java.util.ArrayList;

Import java.util.List;
Import org.apache.http.HttpEntity;
Import Org.apache.http.HttpResponse;
Import Org.apache.http.NameValuePair;
Import org.apache.http.client.HttpClient;
Import org.apache.http.client.entity.UrlEncodedFormEntity;
Import Org.apache.http.client.methods.HttpPost;
Import org.apache.http.impl.client.HttpClients;
Import Org.apache.http.message.BasicNameValuePair;

Import Org.apache.http.util.EntityUtils; public class Yingyanaddenity {public static void main (string[] args) throws IOException {HttpClient cl Ient = Httpclients.createdefault ();//create default HTTP connection HttpPost post = new HttpPost ("Http://yingyan.baidu.com/api/v3
            /entity/add ");//Create a POST request list<namevaluepair> paramlist = new arraylist<namevaluepair> (); Paramlist.add (New Basicnamevaluepair ("AK", ""));//Parameter Paramlist.add (new Basicnamevaluepair ("SN", "") passed
      ;//The parameters passed      Paramlist.add (New Basicnamevaluepair ("service_id", ""));//Parameters passed Paramlist.add (new Basicnamevaluepair ("en Tity_name "," "));//Pass the parameter//put the parameter into the request entity httpentity Entitya = new Urlencodedformentity (paramlist,
            "Utf-8"); Post.setentity (Entitya);//Put the request entity in the POST request HttpResponse response = Client.execute (post);//Use an HTTP connection to perform a GET request and obtain HT TP Response Httpentity entity = response.getentity ();//fetch from response to solid String HTML = Entityutils.tostrin


        g (entity);//translate the response entity into text System.out.println (HTML);
 }

}

I created it before, it prompts

Delete terminal

Package Yingyan;
Import java.io.IOException;
Import java.util.ArrayList;

Import java.util.List;
Import org.apache.http.HttpEntity;
Import Org.apache.http.HttpResponse;
Import Org.apache.http.NameValuePair;
Import org.apache.http.client.HttpClient;
Import org.apache.http.client.entity.UrlEncodedFormEntity;
Import Org.apache.http.client.methods.HttpPost;
Import org.apache.http.impl.client.HttpClients;
Import Org.apache.http.message.BasicNameValuePair;

Import Org.apache.http.util.EntityUtils; public class Yingyandeleteenity {public static void main (string[] args) throws IOException {HttpClient Client = Httpclients.createdefault ();//create default HTTP connection HttpPost post = new HttpPost ("http://yingyan.baidu.com/api/
            V3/entity/delete ");//Create a POST request list<namevaluepair> paramlist = new arraylist<namevaluepair> ();  Paramlist.add (New Basicnamevaluepair ("AK", ""));//The parameter Paramlist.add (new Basicnamevaluepair ("SN") passed,
 (""));//Parameters passed           Paramlist.add (New Basicnamevaluepair ("service_id", ""));//Parameters passed Paramlist.add (new Basicnamevaluepai  R ("Entity_name", "6E90A8A78A4675AE56687523AC848CB4"));//Pass the parameter//put the parameter into the request entity httpentity Entitya =
            New Urlencodedformentity (Paramlist, "utf-8"); Post.setentity (Entitya);//Put the request entity in the POST request HttpResponse response = Client.execute (post);//Use an HTTP connection to perform a GET request and obtain HT TP Response Httpentity entity = response.getentity ();//fetch from response to solid String HTML = Entityutils.tostrin


        g (entity);//translate the response entity into text System.out.println (HTML);
 }
}

Modify Terminal

Package Yingyan;
Import java.io.IOException;
Import java.util.ArrayList;

Import java.util.List;
Import org.apache.http.HttpEntity;
Import Org.apache.http.HttpResponse;
Import Org.apache.http.NameValuePair;
Import org.apache.http.client.HttpClient;
Import org.apache.http.client.entity.UrlEncodedFormEntity;
Import Org.apache.http.client.methods.HttpPost;
Import org.apache.http.impl.client.HttpClients;
Import Org.apache.http.message.BasicNameValuePair;

Import Org.apache.http.util.EntityUtils; public class Yingyanupdateenity {public static void main (string[] args) throws IOException {HttpClient Client = Httpclients.createdefault ();//create default HTTP connection HttpPost post = new HttpPost ("http://yingyan.baidu.com/api/
            V3/entity/update ");//Create a POST request list<namevaluepair> paramlist = new arraylist<namevaluepair> ();  Paramlist.add (New Basicnamevaluepair ("AK", ""));//The parameter Paramlist.add (new Basicnamevaluepair ("SN") passed,
 (""));//Parameters passed           Paramlist.add (New Basicnamevaluepair ("service_id", ""));//Parameters passed Paramlist.add (new Basicnamevaluepai
            R ("Entity_name", ""));//The parameter passed Paramlist.add (new Basicnamevaluepair ("Entity_desc", "This is description");//Parameters passed
            Insert the code into the request entity httpentity Entitya = new Urlencodedformentity (paramlist, "utf-8"); Post.setentity (Entitya);//Put the request entity in the POST request HttpResponse response = Client.execute (post);//Use an HTTP connection to perform a GET request and obtain HT TP Response Httpentity entity = response.getentity ();//fetch from response to solid String HTML = Entityutils.tostrin


        g (entity);//translate the response entity into text System.out.println (HTML);

 }
}
4. Track Upload

Eagle Eye Surveillance Address: http://lbsyun.baidu.com/trace/admin/manager?service_id=164490

Package Uploadyingyan;
Import java.io.IOException;
Import java.util.ArrayList;

Import java.util.List;
Import org.apache.http.HttpEntity;
Import Org.apache.http.HttpResponse;
Import Org.apache.http.NameValuePair;
Import org.apache.http.client.HttpClient;
Import org.apache.http.client.entity.UrlEncodedFormEntity;
Import Org.apache.http.client.methods.HttpPost;
Import org.apache.http.impl.client.HttpClients;
Import Org.apache.http.message.BasicNameValuePair;

Import Org.apache.http.util.EntityUtils; public class Uploadyingyan {public static void main (string[] args) throws IOException {HttpClient client = H Ttpclients.createdefault ();//Create a default HTTP connection HttpPost post = new HttpPost ("Http://yingyan.baidu.com/api/v3/track/addpo
        int ");//Create a POST request list<namevaluepair> paramlist = new arraylist<namevaluepair> ();
        Paramlist.add (New Basicnamevaluepair ("AK", ""));//The parameter passed by Paramlist.add (new Basicnamevaluepair ("SN", "")); Paramlist.adD (New Basicnamevaluepair ("service_id", ""));//Pass the parameter Paramlist.add (new Basicnamevaluepair ("Entity_name", ""));//Pass the Parameter Paramlist.add (new Basicnamevaluepair ("Latitude", "39.9028244029"));//Parameters passed Paramlist.add (new Basicnamev Aluepair ("Longitude", "116.370072895"));//pass parameter long time = System.currenttimemillis ();! [Write a description of the picture here] (https://img-blog.csdn.net/20180427161333562?watermark/2/text/
        AHR0CHM6LY9IBG9NLMNZZG4UBMV0L3DLAXHPBL8ZOTU0OTY1NG==/FONT/5A6L5L2T/FONTSIZE/400/FILL/I0JBQKFCMA==/DISSOLVE/70)
        String Nowtimestamp = string.valueof (time/1000);
        System.out.println (nowtimestamp+ ""); Paramlist.add (New Basicnamevaluepair ("Loc_time", nowtimestamp+ "")), or//parameters passed Paramlist.add (new Basicnamevaluepair ("C Oord_type_input "," bd09ll "));//Pass the parameter//put the parameter into the request entity httpentity Entitya = new Urlencodedformentity (Paramli
        St, "Utf-8"); Post.setentity (Entitya);//Put the request entity in the POST request HttpResponse response = Client.execute (post);//HTTP connection goes to execute GET request and obtains HTTP response httpentity entity = response.getentity ();//from response to sound entity String HTML = Entityuti


    Ls.tostring (entity);//translate the response entity into text System.out.println (HTML);
 }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.