Gallery ¨no media found...¨

Hi i´m developing an android application for a website with installed buddypress. When i do the request (from the app) to get all media uploaded by an user i have this error message:

{¨status¨:¨FALSE¨, ¨status_code¨:160003, ¨message¨:¨no media found for requested media type¨, ¨data¨:false}

but the user have 4 images uploaded and i can see it from the website. This is the code of the request:

final String url="http:/mywesite.com/wp-admin/admin-ajax.php";

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

            @Override
            public void onResponse(String arg0) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(), arg0.toString(), Toast.LENGTH_LONG).show();
            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError arg0) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(), "***Error*** "+ arg0.getMessage().toString(), Toast.LENGTH_LONG).show();
            }
        }) 
        {     
            @Override
            protected Map<String, String> getParams() 
            {  
                    Map<String, String>  params = new HashMap<String, String>();  
                    params.put("action", "rtmedia_api");  
                    params.put("method", "rtmedia_gallery");
                    params.put("token", Globals.accessToken);
                    params.put("media_type", "all");
                    params.put("media_author", "current_user");
                    params.put("global", "true"); 

                    return params;  
            }
        };

Hi @sabirfayssel,

Can you show me the parameters you are sending to get the media. You can check this JSON API doc -> http://docs.rtcamp.com/rtmedia/developer/api/json-api/#GETmediaMethods for more information on how to get uploaded media.

These are the parameters that i send. Do i need to add some other parameters? @riteshpatel thanks for answering.

The parameters are looking fine. Check the privacy of the uploaded media as global = true will only fetch media with privacy set to public. Check this doc -> http://docs.rtcamp.com/rtmedia/developer/api/json-api/ for more information on JSON API.

I can´t see or change the privacy of the uploaded media with the basic version of rtmedia, that is possible just with the pro package. I have read the doc but i haven´t found anything that can help me. i tried to change global to false but nothing, i have the same error. Any suggestion?

Privacy is part of rtMedia basic version. You can set default privacy of media from {site_url}/wp-admin/admin.php?page=rtmedia-settings#rtmedia-privacy page. You can also check privacy of uploaded media by opening media into lightbox. You can check privacy symbol right below title, besides upload date in lightbox.

What exactly is your required output?

I have setup privacy to pubblic but nothing is changed. In output i want all media that the (current) user have uploaded. I really don´t understand where is the error.

I solved my problem. The error it was in this line:

params.put(“media_author”, “current_user”);

The author should be indicated with its id.

Thanks a lot @riteshpatel for the time spent to help me.

Hi @sabirfayssel,

We are glad to know that your issue is solved.

1 Like