Tag Info

Hot answers tagged

3

As of version 2.0 of the API, answers can return a link field in the response, which can be returned in the response by creating a filter that includes it:


3

There is "accepted_answer_id" for questions method. When there is no accepted answers,that field does not exists in returned JSON. So hasAccepted is the existance of "accepted_answer_id" field.


3

You have to generate any links back to "proper" SO yourself. The most any of the API methods will give you is (relative) links to other API methods.


2

This is [by-design]. /search is already pretty resource intensive, and not returning answers is a conscious effort to reduce its runtime. The answers parameter does not appear in the documentation for /search accordingly.


2

Confirming weirdness with the /users/{id}/answers route. For example, these two queries yield completely different results, although the second one only has a pagesize and page parameters: http://api.stackoverflow.com/1.0/users/180784/answers http://api.stackoverflow.com/1.0/users/180784/answers?pagesize=10&page=1 I would have expected the first 10 ...


2

The API filters are kept pretty simple, and there is no way to restrict these answers to just accepted answers. Your app would loop through the items array and return/handle only those where is_accepted is true. Since you appear to be using PHP, the Stack.PHP library may save you time and effort, overall.


2

The most straightforward way to get the body is to use the named withbody filter, which you pass in as the value of the filter parameter (example). This will give you all of the default fields, along with the post body. You can also create a custom filter that passes back question.body and answer.body where appropriate along with your select choice of other ...


2

If the answer is the accepted answer, is_accepted is true and anyone can see it. accepted is set to true only if the currently authenticated user is the one who has accepted the answer. For instance, if I obtain an access_token with the private_info privilege and call: /2.2/questions/30028657/answers?site=stackoverflow&key={YOUR APP ...


2

If you just want the total, don't bother paging through the entire full result set. Use the total property of the Common Wrapper Object. This will save lots of time and bandwidth and quota and doesn't require you to loop through the results just to count things. The total property is not enabled by default, so you will need to Create a custom filter for ...


2

It does return all the answers, but they're paged - by default you'll only get 30 at a time. You'll likely want to increase pagesize to 100, and then add the additional code necessary to make subsequent requests if has_more is set on the response wrapper. So, for example, your first request would be like ...


1

last_editor will be missing (empty) from the results when the last editor is a deleted user. This deleted user does not have to be the owner, or original poster, of a given question or answer. For example, see this answer -- which looks like this in the API: { "owner": { "user_id": 362168, "user_type": "registered", "display_name": "Saqueib" ...


1

The /search/excerpts route looks to be about as good as /search and it does return both questions and answers, and it does have an answers parameter. This route is "★ All new! For version 2.2! ★"


1

The method I ended up using in SOUP 1.10 is the first one listed above — loading the full question page and stripping it down to match the review interface. Here's the core of the actual code: var injectAnswers = function ( html ) { // kluge: disable script tags; $.parseHTML() would be better, but needs jQuery 1.8+ var $html = $( ...


1

To do this you have to use the /users/{ids}/answers path to download all of a user's answers, and then filter out the tags and/or tot-up the scores from there. Pseudo code: scoreByTag = [] // Empty associative array while (more pages of results) { 1) Fetch next page of answers 2) Store results and/or update scoreByTag array } Display/use select ...


1

Its because post id 74 is an answer, not a question. This was an undiscovered bug in the API back when we froze it, but enough [app]s depend on it that we haven't "fixed" it. Naturally, answers have no titles or tags.


1

These are two simple methods in meta-language: 1. Pulls a pagesize number of answers, page after page, checking the presence of the given accepted_answer_id def get_accepted_answer_page(question_id, answer_id, sort, pagesize): page = 1 while(True): answers_page_ids = get_answers_ids_with_API_method(question_id, sort, page, pagesize) ...


1

This should be fixed now. (Its kind of safe to assume these are bugs by the way, we are in beta)


1

This has been fixed. Example


1

I believe the sort=votes parameter is for when you are retrieving multiple questions in one API call, such as with this URL - the questions in the response are ordered by vote. http://api.stackoverflow.com/0.8/questions/1429951;2383701;619895?sort=votes&type=jsontext In terms of how you could sort the responses - you do have the up + the down vote ...



Only top voted, non community-wiki answers of a minimum length are eligible