android: invoke 7 digital app with artist's release id

20 views
Skip to first unread message

Alexander Savenok

unread,
Oct 15, 2011, 5:29:31 PM10/15/11
to 7digital API Developers
I need to invoke 7digital application from my android app. I saw an
example here http://developer.7digital.net/7digitalonMobile, which
allows to execute search in 7digital, right after application was
invoked. But in my case I don't need to execute search, I need to show
tracks from artist's album. Artist and release id are known. Is it
possible?
Thanks.

helde...@gmail.com

unread,
Oct 16, 2011, 2:09:38 PM10/16/11
to 7digit...@googlegroups.com
I too am using 7digital's api for Android, however I'm calling the webservice directly, instead of integrating with 7digital's app.
You can get the tracks from the artist album using the webservice 'release/tracks' from the API.

For example, in my code I used DOM to call the webservice and to parse the output, below is a snippet:

        String urlStr = ENDPOINT + "release/tracks?";   //ENDPOINT = "http://api.7digital.com/1.2/"
        String reqParam = "releaseid="+releaseId+"&oauth_consumer_key="+ CONSUMER_KEY+ "&pagesize=50&page=1&imageSize=200"; // CONSUMER_KEY is your dev key
                                                                                                                                                                                                                               //get 50 songs max from a release, cover arts with size 200

        try {
            URL url = new URL(urlStr+reqParam);           
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new InputSource(url.openStream()));
            doc.getDocumentElement().normalize();

            //check response
            fstNmElmntLst = doc.getElementsByTagName("response");
            fstNmElmnt = (Element) fstNmElmntLst.item(0);
            if(!fstNmElmnt.getAttribute("status").equalsIgnoreCase("ok")){
                Log.w(Util.APP, "7digital 'release/tracks' call failed with code ["+fstNmElmnt.getAttribute("status")+"]");
                throw new ServiceCommException(ServiceID.SEVENDIGITAL, ServiceErr.REQ_FAILED); //that is my exception, you can create yours
            }   

            songs = parseSongDetails(doc.getDocumentElement()); //this is the method that parse the response using DOM



--

Helder Martins

Alexander Savenok

unread,
Oct 16, 2011, 3:26:37 PM10/16/11
to 7digital API Developers
thanks for your answer, but my customer wants to use 7digital app if
it's possible.
Reply all
Reply to author
Forward
0 new messages