1

i need help to connect to this api

this is Documentation:

http://www.jazzradio.fr/api-docs

the website example is in php and i not understand

i have public-key and private-key

i tried volley

    // Instantiate the RequestQueue.
            RequestQueue queue = Volley.newRequestQueue(this);
            String url ="http://www.jazzradio.fr/api/news";

// Request a string response from the provided URL.
            StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response) {
                            // Display the first 500 characters of the response string.
                            tx.setText("Response is: "+ response.toString());
                        }
                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    tx.setText("That didn't work!");
                }
            });
// Add the request to the RequestQueue.
            queue.add(stringRequest);

the result:

{"error":{"code":401,"title":"Unauthorized #0"}}

how to send public-key and private-key to be authorized

Essam Goda
  • 23
  • 7
  • Looks like that you should override getHeaders in which set 'X-Public-Key', and 'X-Request-Hash ' (which is generated from your keys). – BNK Sep 11 '15 at 00:37
  • To generate hash, try following links http://stackoverflow.com/questions/6026339/how-to-generate-hmac-sha1-signature-in-android and http://stackoverflow.com/questions/8396297/android-how-to-create-hmac-md5-string – BNK Sep 11 '15 at 00:44

0 Answers0