質問

I have been trying for hour every possible method on this forum but no luck. PLEASSE help I have the following server url

String url = "http://namara.io/api/v0/resources/fef59c15-852f-4f4b-aaef-c9475b3d17c6/data?where=%7b%22column%22:3,%22selector%22:%22eq%22,%22value%22:%22Sercan%22%7d"

Here is my code:

HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpResponse response;
try {
response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
.
.
.

However i am always getting null values. When I check the StatusLineReturned code, it is saying error 401: Uauthorized.

I have no idea what is it that I am doing wrong? Why it won't just work!

役に立ちましたか?

解決

Posting an answer from comments:

If you'll try to open it in browser, it says the same, so you need to authorize at first. Per docs at namara.io, you have to provide api_key.

他のヒント

just out of curriousity : can u try

URL u = new URL(youurl);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);

if it doesnt work , maybe you need to use a post not get method

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top