2

Alchemy API is used in my program for extracting keywords and relations from a URL.

When extracting these from the API calls I'm getting the error as follows,

'java.io.IOException: Error making API call: cannot-retrieve:downstream-http-error:404. at com.alchemyapi.api.AlchemyAPI.doRequest(AlchemyAPI.java:960) at com.alchemyapi.api.AlchemyAPI.GET(AlchemyAPI.java:914) at com.alchemyapi.api.AlchemyAPI.URLGetRankedKeywords(AlchemyAPI.java:234) at com.alchemyapi.api.AlchemyAPI.URLGetRankedKeywords(AlchemyAPI.java:224) at innointel.feature1.Article.alchemyCall(Article.java:477)'

Then I found "http://venturebeat.com/2014/10/22/microsoft-and-ibm-partner-to-bring-enterprise-software-to-their-respective-cloud-platforms/" was the URL causing the error.I called the relation API simply putting the URL as follows ..

Document doc = alchemyObj.URLGetRelations("http://venturebeat.com/2014/10/22/microsoft-and-ibm-partner-to-bring-enterprise-software-to-their-respective-cloud-platforms/");

Well now, it contains no error . What is actually happening here ??

I found in some websites that "cannot-retrieve:downstream-http-error:404" is due to the invalid URL passed as argument. Out Of 50 URL i tested 7 URL shows the error.Remaining works fine.And again when i extract the URL string placed it as a argument 7 URL works fine too..

(URL is parsed from an excel document using POI API)

Thanks in advance

1 Answers1

1

As you said

'java.io.IOException: Error making API call: cannot-retrieve:downstream-http-error:404'

Exception is caused by the wrong URL argument in function call (ie.URLGetRankedKeywords()) Since the URL is parsed from the EXCEL Document some times the '\r' character might be present at the end of the cell.If present, this will make the URL invalid . What you can do is , Remove all '\r' character from the URL before you pass it to API call.

ie ,

url = url.replaceAll("\r", "");
Document doc = alchemyObj.URLGetRelations(url);

This might work.it's worked for me.

Lygub Org
  • 125
  • 8