-1

I got the problem with diffbot url encode problem. I have a URL and I pass url when I call diffbot api like this.

//JsonNode json= (JsonNode)client.analyze(DiffbotClient.ResponseType.Jackson,url);

but I got error massage about url encoding.this is error message that I got

{"errorCode":500,"error":"URL encoding"}

So I change my code system like this.

//JsonNode json= (JsonNode) client.analyze(DiffbotClient.ResponseType.Jackson,u.getHost()+u.getPath()+URLEncoder.encode("?"+u.getQuery(),"UTF-8"));

but it doesn't work out and Diffbot print like that

{"errorCode":500,"error":"Error."}.

what kind of Encoding format diffbot API is using?

Kristiyan Varbanov
  • 2,439
  • 2
  • 17
  • 37
sai aung myint soe
  • 139
  • 1
  • 1
  • 12
  • _"I got error message..."_ -- ***what error message?*** _"it doesn't work"_ -- ***HOW*** does it not work? What happens? Your question is not answerable in its present form. Please [edit] your question to include the relevant information. – Jim Garrison Mar 20 '16 at 16:27
  • I got {"errorCode":500,"error":"Error."} error message from Diffbot. I also change in my question. – sai aung myint soe Mar 20 '16 at 16:34

1 Answers1

0

You're supposed to only encode the URL the contents of which you're processing with Diffbot, not the entire API string. For example, replace {{token}} below with your own and visit the URL in the browser. It will work.

Use this as inspiration to build your own URL for the API call:

http://api.diffbot.com/v3/article?token={{token}}&url=http%3A%2F%2Fwww.sitepoint.com%2Fdiffbot-crawling-visual-machine-learning%2F

As you can see, only the url query param is encoded, and it's no special encoding, it's just basic HTML entity encoding.

Swader
  • 11,387
  • 14
  • 50
  • 84
  • http://api.diffbot.com/v3/article?token={{token}}&url=http://www.sitepoint.com/diffbot-crawling-visual-machine-learning/ I call with this URL. but it working too... I don't clear what you said about entire API. – sai aung myint soe Mar 23 '16 at 03:55