Wanna chat/ask questions about our API? You've come to the right place! ;)
People
Repo info
Activity
Pei Yuecheng
@yueCheng_gitlab
Hi, I'm a college student who is using your API to do a coursework. I'm using JAVA, but I failed to get response from your server(403), although my url is correct and can get correct response in browser(I use right API and token). Here question is your API just support Python, not JAVA ? Looking for your reply, thank you in advance.
Pei Yuecheng
@yueCheng_gitlab
Emm... I don't understand the diffrence between using a kind of programming language and using browser(or Postman) to invoke API, in my personal perspective, both ways are using the same url ,the same endpoint. Can you give any idea about this ? Sorry to disturb you.
Subhash Ramesh
@thecooltechguy
Hi @yueCheng_gitlab , nice to meet you! Our REST API can be accessed from any programming language, not just Python. Could you share some of the Java code you're using, so that I can see why it's not working? Thanks! :D
Oh ok, thanks for the info. I'll go ahead and look at it now.
Pei Yuecheng
@yueCheng_gitlab
but this url is perfect in browser
Subhash Ramesh
@thecooltechguy
yup, I just tried and it works in the browser. Let me try in Java now
Pei Yuecheng
@yueCheng_gitlab
thank you in advance
I'm struggling here
it's 02:01 am now haha
Subhash Ramesh
@thecooltechguy
Of course, happy to help! :D Sorry to hear that you're facing this issue! I'm debugging it now
Hey, can you try using HttpsURLConnection instead of HttpURLConnection?
Pei Yuecheng
@yueCheng_gitlab
alright I'm trying
Subhash Ramesh
@thecooltechguy
ok cool, let me know how it goes
Subhash Ramesh
@thecooltechguy
Hey @yueCheng_gitlab , I've solved the issue! Just insert the following line of code after you call connection.setRequestMethod("GET"): connection.addRequestProperty("User-Agent", "Mozilla/4.0");
This will work
you can actually continue to use HttpURLConnection
It's a kind of "cross domain request" problem, right?not sure. now its can connect to your API, but I get empty response, no data. I'm still trying to work out this problem