ReST API protection

I am creating an Android app that will interact with the ReST API. And I want to know how I can ensure the security of the APIs.

Here is my example API method

@GET
    @Path("/count")
    public String totalUserCount(){
        return "100";
    }

      

and here is my api call from android

StringRequest stringRequesttoNearby = new StringRequest(
                        Request.Method.GET, 
                        url,
                        new Response.Listener<String>() {

                            @Override
                            public void onResponse(String responseString) {
                             //response
                            }
                        }, 
                        new Response.ErrorListener() {
                            @Override
                            public void onErrorResponse(VolleyError error) {
                            }
                        })
                {
                    @Override
                    protected Map<String,String> getParams(){
                        Map<String,String> params = new HashMap<String, String>();                  
                        return params;
                    }
                };
                //add request to queue
                Singleton.getInstance().getRequestQueue().add(stringRequesttoNearby);

      

So, I want to know how to add security for this API call

+3


source to share


1 answer


You can use Oauth1.0a, Oauth2 check link



Follow the link Secure Api

0


source







All Articles