I have generated the key and secret now I don't know how to use the key and secret so that I can get the data from server into my Android app. Can anyone tell the the proper procedure of it? How can i Create the signature , nonce and other things t authenticate ?
Asked
Active
Viewed 843 times
1 Answers
-1
Using Volley library is the easiest way to connect to APIs. For example
RequestQueue queue = Volley.newRequestQueue(this);
String url = this.apiURl; //you could store it as config at raw
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest
(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
// do nice things with your beautiful response
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Handle error if any
}
});
queue.add(jsonObjectRequest);
Woocommerce sends json response so use the JsonObjectRequest
so you need not convert the String to Json again.
Hope this helps!

banstola
- 47
- 2
-
What To do with Consumer Key And Consumer Secret ? – Akshat Kumawat Apr 04 '18 at 10:58
-
if you have checked the woocommerce REST api doc you can put those keys as query params – banstola Apr 04 '18 at 10:59
-
how can i put the key and secret for Auth ? – Akshat Kumawat Apr 04 '18 at 11:15
-
`?consumer_key={}&consumer_secret={}` – banstola Apr 04 '18 at 11:44
-
Sir i know how to work with http request and i have tried this.. i have tried sending the consumer_key and cosumer_secret as the params ... But i got an error here { "code": "woocommerce_rest_cannot_view", "message": "Sorry, you cannot list resources.", "data": { "status": 401 } } – Akshat Kumawat Apr 04 '18 at 11:48
-
It is not just using volley, it needs to provide the way to set up basic auth – Almeida Dec 12 '18 at 15:37