Allo cine Web service Changed

May 2, 2013 at 9:59 PM

The web service changed and so your API does not work :

I begin to rewrite the search function to make it work again
        #region Declarations
        private readonly WebClient _client;
        private const string AlloCineBaseAddress = "";
        private const string SearchUrl = "search?partner=100043982026&{0}";
        private const string MovieGetInfoUrl = "movie?partner=100043982026&{0}";
        private const string MovieGetReviewListUrl = "reviewlist?partner=100043982026&{0}";
        private const string PersonGetInfoUrl = "person?partner=100043982026&{0}";
        private const string PersonGetFilmographyUrl = "filmography?partner=100043982026&{0}";
        private const string MediaGetInfoUrl = "media?partner=100043982026&{0}";
        private const string TvSeriesGetInfoUrl = "tvseries?partner=100043982026&{0}";
        private const string TvSeriesSeasonGetInfoUrl = "season?partner=100043982026&{0}";
        private const string TvSeriesEpisodeGetInfoUrl = "episode?partner=100043982026&{0}"; 
        private const string SecretKey = "29d185d98c984a359e6e6f26a0474269";

#region Search Function
        /// <summary>
        /// Search any reference of a title in the AlloCine database.
        /// </summary>
        /// <param name="query">The query string you are searching for.</param>
        /// <param name="types">The types of information you whish to include in the response from AlloCine.</param>
        /// <param name="resultsPerPage">The maximum number of results per page to be returned.</param>
        /// <param name="pageNumber">The page you want to show in case your query returns more results than the maximum value you have specified to fit on one page.</param>
        /// <returns>Returns a Feed object.</returns>
        public Feed Search(string query, IEnumerable<TypeFilters> types, int resultsPerPage, int pageNumber)
            var nvc = new NameValueCollection();
            if (!string.IsNullOrEmpty(query))
                nvc["q"] = HttpUtility.UrlEncodeUnicode(query);

            nvc["format"] = ResponseFormat.Json.ToString().ToLower();

            if (types != null)
                nvc["filter"] = string.Join(",", types).ToLower();

            //if (resultsPerPage > 0)
            //    nvc["count"] = resultsPerPage.ToString();

            //if (pageNumber > 0)
            //    nvc["page"] = pageNumber.ToString();

            var searchQuery = string.Join("&", nvc.AllKeys.Select(k => string.Format("{0}={1}", k, nvc[k])));
            string sed = System.DateTime.Now.ToString("yyyyMMdd");
            System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();

            string sig = HttpUtility.UrlEncode(System.Convert.ToBase64String(sha.ComputeHash(System.Text.Encoding.ASCII.GetBytes(SecretKey + "partner=100043982026&" + searchQuery + "&sed=" + sed))));         
            searchQuery += "&sed=" + sed + "&sig=" + sig;

            var alObjectModel = DownloadData(string.Format(SearchUrl, searchQuery), typeof(AllocineObjectModel)) as AllocineObjectModel;

            if (alObjectModel != null)
            {   //If AlloCine returned an Error, we assigned the Error object to the Feed Error Object for easy check 
                //from the class client side
                if (alObjectModel.Error != null)
                    alObjectModel.Feed = new Feed { Error = alObjectModel.Error };
                return alObjectModel.Feed;
            return null;
It's works :
But the "count" parameter and "page" no longer seems to work.
And the order of parameter is significant i think.
May 5, 2013 at 9:23 AM
Edited May 5, 2013 at 9:23 AM
Hello Zaltez,

Thank you for the warning, not being a user of this library myself I did not notice it was broken due to some changes in the API.
I am actually working on a fix and hope to have it published very soon..

May 11, 2013 at 10:46 AM
Hello Zaltez,

I am happy to announce I have resolved all the issues with the new query signature mechanism.
Also the call for Large response profile was also broken some time ago but is now working again.

I will publish the new version of the class very soon.
Stay tuned :)

May 12, 2013 at 8:24 PM
Hello Zaltez,

The new version 1.1 is now available for download.

May 14, 2013 at 5:41 PM
Hello Patou

Great I can continue my application and make a return quickly

thank you very much 😊
Envoyé depuis Courrier Windows
De : Patou
Envoyé : ‎dimanche‎ ‎12‎ ‎mai‎ ‎2013 ‎21‎:‎24
À : [email removed]

From: Patou

Hello Zaltez,

The new version 1.1 is now available for download.