0

I have looked in so many places on a lead on how or if it is possible to view images uploaded to cloudinary, by a specific tag through Android studio app i am trying to build.

I was able to implement the upload option by user, with adding a tag to the images, and public id, also retrieving these information, but i cant find anything on how to view these images, for example i want the app to be able to view all images with a specific tag ( username ) to the user that uploaded the pictures, and could delete them ? and also view other images uploaded by other user with no other permission.

Is it possible and how !?

I ended up with this code, and i encountered a problem;

             @Override
        public void onClick(View v) {

            new JsonTask().execute("http://res.cloudinary.com/cloudNAme/video/list/xxxxxxxxxxxxxxxxxxx.json");
           // uploadExtract();
        }
    });

 public class JsonTask extends AsyncTask<String ,String,String> {

    @Override
    protected String doInBackground(String... params) {
        HttpURLConnection connection = null;
        BufferedReader reader = null;
        try {
            URL url = new URL(params[0]);
            connection = (HttpURLConnection) url.openConnection();
            connection.connect();

            InputStream stream = connection.getInputStream();
            reader = new BufferedReader(new InputStreamReader(stream));

            StringBuffer buffer = new StringBuffer();

            String line = "";
            while ((line = reader.readLine()) != null) {
                buffer.append(line);
            }
            return buffer.toString();


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();


            }
            try {
                if (reader != null) {
                    reader.close();

                }
            } catch (IOException e) {
                e.printStackTrace();

            }
        }
        return null;
    }

In the log i get the following;

03-28 12:36:14.726 20333-21459/net.we4x4.we4x4 W/System.err: java.io.FileNotFoundException: http://res.cloudinary.com/we4x4/video/list/3c42f867-8c3a-423b-89e8-3fb777ab76f8.json

i am not sure if my understanding is correct of the method or i am doing something wrong ? since in the Admin API Docs. or cloudinary the syntax for the HTML request and also in the suggested page by Nadav:

https://support.cloudinary.com/hc/en-us/articles/203189031-How-to-retrieve-a-list-of-all-resources-sharing-the-same-tag-

this should've returned a JSON ?

madnomad10011
  • 341
  • 2
  • 6
  • 19

1 Answers1

1

The following feature allows you to retrieve a JSON formatted list of resources that which share a common tag:
https://support.cloudinary.com/hc/en-us/articles/203189031-How-to-retrieve-a-list-of-all-resources-sharing-the-same-tag-

Note that image removal will coerce you to use server-side code (e.g. JAVA), since deleting via Cloudinary requires a signature that is based on your API_SECRET.

Nadav Ofir
  • 778
  • 4
  • 6
  • Thank you for the links, really helped on giving me an idea on how to achieve that, although i am kind of having some difficulty to do it properly after requesting the result, and how to extract the images list from the JSON, also could you please instruct me exactly how to do that without the api_secret , not clear in the link on how to do that in java/android studio – madnomad10011 Mar 27 '16 at 12:31
  • @Nadav_Ofir i have encountered a problem trying to apply the method demonstrated in the Admin API Docs. as you could see above i posted the code i am using and the Error from the stacktrace – madnomad10011 Mar 28 '16 at 15:38
  • @JanusJanus Check out the response when accessing the URL. You have an error there - `X-Cld-Error:Resources of type list are restricted in this account`. You should first allow "Resource list" via your account [Security Settings](https://cloudinary.com/console/settings/security) page. – Nadav Ofir Mar 29 '16 at 07:39
  • BTW, it's not related to the Admin-API neither it requires your `API_SECRET` - this is a pure client-side feature. – Nadav Ofir Mar 29 '16 at 07:41