stackexchange-api

Date format in the Stack Exchange API

笑着哭i 提交于 2019-12-10 16:39:53
问题 When I query Stack Overflow (using it's API) to get some data (questions/answers/etc) I get the following JSON response: "down_vote_count": 0, "last_activity_date": 1300830790, "creation_date": 1300829790, The last_activity_date is a 10 digit number corresponding to some date in 1970. when I test today's timestamp (in Java if it's important) I get a 13 digit number. What is the format of the date timestamps in the responses I get? How do I translate it to regular Unix timestamp? Thanks. 回答1:

stack exchange api post method

假装没事ソ 提交于 2019-12-07 16:33:02
问题 I am trying to upvote a question using the stackexchange api in android. using the url https://api.stackexchange.com/2.2/questions/{questionID}/upvote but in the log its just showing something like this org.apache.http.message.BasicHttpResponse@33b2c539 API link for upvote a question is https://api.stackexchange.com/docs/upvote-question When I am trying from api link its working, but not with the code. Find below the code below: String url= "https://api.stackexchange.com/2.2/questions/"

How to retrieve stackoverflow tag usage count via stackexchange api call?

允我心安 提交于 2019-12-07 13:02:31
问题 I want to retrieve the 'tag usage count' of a language like Ruby or Java via the StackExchange API. Basically I want to retrieve these numbers via API call: https://stackoverflow.com/tags e.g. how do I get the 780k for Java as seen in the link via StackExchange API call? Does anyone know? I tried this: https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=activity&tagged=java&site=stackoverflow but that doesn't give me the total count It seems to be easy with the Stack Exchange

How to retrieve stackoverflow tag usage count via stackexchange api call?

你说的曾经没有我的故事 提交于 2019-12-06 00:09:07
I want to retrieve the 'tag usage count' of a language like Ruby or Java via the StackExchange API. Basically I want to retrieve these numbers via API call: https://stackoverflow.com/tags e.g. how do I get the 780k for Java as seen in the link via StackExchange API call? Does anyone know? I tried this: https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=activity&tagged=java&site=stackoverflow but that doesn't give me the total count It seems to be easy with the Stack Exchange Data Explorer http://data.stackexchange.com/stackoverflow/query/229727 But how to retrieve these counts

Getting null as response from Stack Overflow API with PHP

£可爱£侵袭症+ 提交于 2019-12-03 16:47:24
I use this code for PHP to get Stack Overflow reputation. $feed = json_decode(file_get_contents("http://api.stackexchange.com/2.1/users/22656?order=desc&sort=reputation&site=stackoverflow&filter=!*MxOyD8qN0Yghnep", true), true); $array = $feed['items'][0]; $rep = $array['reputation']; echo $rep; But I get null for feed. Also user account is Jon Skeet which is where I get the ID 22656. How can I fix this? The problem is that the response is also gzipped. My preferred fix would be to use curl, with CURLOPT_ENCODING option. <?php function curl($url){ $curl = curl_init(); curl_setopt($curl,

Can I check with the Stackoverflow API which SO answerers are sleep-deprived?

。_饼干妹妹 提交于 2019-12-03 11:35:50
问题 In how-do-i-access-the-stackoverflow-api-from-mathematica I outlined how one could use the SO API to get Mathematica to make some interesting reputation graphs of top answerers. Could this API also be used to provide some privacy-invading insights in the answerers' nocturnal habits? 回答1: Certainly, for instance using this MMA8 code: getActionDates[userID_Integer] := Module[{total}, total = "total" /. Import["http://api.stackoverflow.com/1.1/users/" <> ToString[userID] <> "/timeline?pagesize=1

Can't get data from Stack Exchange API

戏子无情 提交于 2019-12-02 06:54:22
问题 I am trying to get data from http://api.stackoverflow.com/1.1/search?tagged=php . I am using this code to get data from the API: $url = "http://api.stackoverflow.com/1.1/search?tagged=php"; $json = file_get_contents($url); $json_data = json_decode($json, true); print_r($json); But it is showing me nothing. I have also used curl to get the data, but it also shows nothing. Why isn't it showing me anything, and how can I fix that? 回答1: They are returning you gzipped content as response. That's

Encoding issue with requesting JSON from StackOverflow API

梦想的初衷 提交于 2019-12-01 17:18:22
I can't figure this out for the life of me. Below is an implementation with the request module, but I've also tried with the node-XMLHttpRequest module to no avail. var request = require('request'); var url = 'http://api.stackexchange.com/2.1/questions?pagesize=100&fromdate=1356998400&todate=1359676800&order=desc&min=0&sort=votes&tagged=javascript&site=stackoverflow'; request.get({ url: url }, function(error, response, body) { if (error || response.statusCode !== 200) { console.log('There was a problem with the request'); return; } console.log(body); // outputs gibberish characters like �

Http request to stackexchange api returns unreadable json

浪尽此生 提交于 2019-12-01 11:01:26
问题 I'm trying to fetch some json data from the stackexchange api. Receiving the OAuth code and access token works fine. But when calling the actual datafetching endpoints, the response does look wierd. Probably encoded or similar. The request looks like this: var client = requestjson.newClient('https://api.stackexchange.com'); client.get("/2.2/me/comments?order=desc&sort=creation&site=stackoverflow&access_token="+myToken+"&key="+key, function(err, res, body) { console.log(body); }) And then the

JSON URL from StackExchange API returning jibberish?

房东的猫 提交于 2019-12-01 06:51:11
I have a feeling I'm doing something wrong here, but I'm not quite sure if I'm missing a step, or am just having an encoding problem or something. Here's my code: URL url = new URL("http://api.stackoverflow.com/0.8/questions/2886661"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); // Question q = new Gson().fromJson(in, Question.class); String line; StringBuffer content = new StringBuffer(); while ((line = in.readLine()) != null) { content.append(line); } When I print content, I get a whole bunch of wingdings and special characters, basically jibberish. I