Access to Android Volkswagen reviews

Source: Internet
Author: User

Here is a popular review of the purchase of an interface, that is, all group purchase information, the implementation of the other interface is similar.

First, a public review of the development platform, which is logged in to Volkswagen reviews. Then get to your own application of Appkey and secret, this is a prerequisite for development. You can download the Demo->demo provided by the Volkswagen reviews.

Get all group purchase information:

Dzdpapitool.java Volkswagen reviews the API tool classes provided (Request API, Requestapi this method)

public class Dzdpapitool {/** * GET request String * * @param appKey * @param secret * @param parammap * @re        Turn */public static String getquerystring (String AppKey, String secret, map<string, string> parammap) {        String sign = sign (AppKey, secret, Parammap);        StringBuilder StringBuilder = new StringBuilder ();        Stringbuilder.append ("appkey="). Append (Appkey). Append ("&sign="). Append (sign); For (entry<string, string> entry:paramMap.entrySet ()) {stringbuilder.append (' & '). Append (ent        Ry.getkey ()). Append (' = '). Append (Entry.getvalue ());        } String queryString = Stringbuilder.tostring ();    return queryString;     /** * Gets the request string, the parameter value is UTF-8 processed * * @param appKey * @param secret * @param parammap * @return    */public static string Geturlencodedquerystring (String AppKey, String secret, map<string, string> Parammap) {String sign = sign (AppKey, secRET, PARAMMAP);        StringBuilder StringBuilder = new StringBuilder ();        Stringbuilder.append ("appkey="). Append (Appkey). Append ("&sign="). Append (sign); For (entry<string, string> entry:paramMap.entrySet ()) {try {Stringbu                                                                                                      Ilder.append (' & '). Append (Entry.getkey ()). Append (' = '). Append (Urlencoder.encode (Entry.getvalue (),            "UTF-8")); } catch (Unsupportedencodingexception e) {}} String queryString = STRINGB        Uilder.tostring ();    return queryString; }/** * Request API * * @param apiurl * @param appKey * @param secret * @param parammap * @retur n */public static string Requestapi (String Apiurl, String AppKey, String secret, map<string, string> Paramma p) {String queryString = getquerystring (AppKey, secret, parAMMAP);        StringBuffer response = new StringBuffer ();        Httpclientparams httpconnectionparams = new Httpclientparams ();        Httpconnectionparams.setconnectionmanagertimeout (1000);        HttpClient client = new HttpClient (httpconnectionparams);        HttpMethod method = new GetMethod (Apiurl); try {if (queryString! = null &&!querystring.isempty ()) {//Encode Q                Uery string with UTF-8 string encodequery = Uriutil.encodequery (queryString, "UTF-8");            Method.setquerystring (Encodequery);            } client.executemethod (method);            BufferedReader reader = new BufferedReader (New InputStreamReader (Method.getresponsebodyasstream (), "UTF-8"));            String line = null; while (line = Reader.readline ())! = null) {Response.append (line). Append (System.getproperty ("Li            Ne.separator "));        } reader.close ();      }  catch (Uriexception e) {} catch (IOException e) {} finally {        Method.releaseconnection ();    } return response.tostring (); /** * Signature * * @param appKey * @param secret * @param parammap * @return */public stat IC string sign (String AppKey, String secret, map<string, string> parammap) {//Parameter name sort string[] Keya        Rray = Parammap.keyset (). ToArray (new string[0]);        Arrays.sort (Keyarray);        Stitching parameters StringBuilder StringBuilder = new StringBuilder ();        Stringbuilder.append (AppKey);        for (String Key:keyarray) {stringbuilder.append (key). Append (Parammap.get (key));        } stringbuilder.append (Secret);        String codes = stringbuilder.tostring ();        SHA-1 Signature//For Android string sign = new String (Hex.encodehex (Digestutils.sha (Codes))). toUpperCase ();    return sign; }}
Then call the interface

map<string, string> parammap = new hashmap<string, string> ();p arammap.put ("City", city);p Arammap.put (" Limit ", 1);p arammap.put (" page ", offset +");p Arammap.put ("region", region);D Zdpapitool.requestapi (HTTP// Api.dianping.com/v1/deal/find_deals, Appkey, sign, parammap);
Parameters: (Quote public comments)

  • Required Parameters
    name type description
    Appkey String App Key, app's unique identity
    Sign String Request signature, generated by the API request signature Generation document
    City String The name of the city containing the group purchase information, see the relevant API to return the results
  • Optional Parameters
    name type description
    Destination_city String Specify the destination city name, applicable to "hotel", "travel" and other categories, optional range see relevant API return results
    Latitude Float Latitude coordinates, which must be passed in at the same time as longitude coordinates
    Longitude Float Longitude coordinates must be passed in at the same time as the latitude coordinate
    Radius Int Search radius, in meters, minimum 1, maximum 5000, if not passed in by default is 1000
    Region String The name of the city that contains the group purchase information, see the relevant API return results (excluding the city name information included in the returned results)
    Category String Includes the category name of group purchase information, supports multiple category merge queries, multiple categories are separated by commas. Optional range See related API return results
    Is_local Int Filter the returned buy based on whether it is a local single, 1: Yes, 0: not
    Keyword String Keywords, search scope includes merchant name, product name, address, etc.
    Sort Int Results sorted, 1: Default, 2: Low price priority, 3: High price priority, 4: Number of buyers priority, 5: The latest release priority, 6: Near the end of priority, 7: distance from latitude and longitude coordinates close to the first
    Limit Int The maximum number of results entries returned per page, minimum 1, max 40, if not passed in by default is 20
    Page Int Page number, if not passed in by default is 1, that is, the first page
    Format String Return data format, optional value JSON or XML, if not passed in, the default value is JSON




Access to Android Volkswagen reviews

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.