3

I am trying to use the Stack Exchange API to see the trends on different topics.

Looking at the API documentation, I see that I could do this using the /search path (it's documented that this method is limited, although it doesn't mention if meaning to results limits or other kind of limitations).

I also tried /advanced-search.

There is no mention to any kind of limitation for this one. However, I don't get the same results that I get when searching on the website.
For example:

/2.2/search/advanced?order=desc&sort=activity&q=raml rest&site=stackoverflow

(no page size, no limit, no nothing) yields:

{
  "items": [
    {
      "tags": [
        "rest",
        "azure",
        "code-generation"
      ],
      "owner": {
        "reputation": 16,
        "user_id": 1224349,
        "user_type": "registered",
        "profile_image": "https://www.gravatar.com/avatar/76aaf9ca0eb0910b440909a2faa1dd9a?s=128&d=identicon&r=PG",
        "display_name": "Paul Topping",
        "link": "https://stackoverflow.com/users/1224349/paul-topping"
      },
      "is_answered": true,
      "view_count": 24,
      "answer_count": 1,
      "score": 1,
      "last_activity_date": 1399090892,
      "creation_date": 1399052046,
      "question_id": 23433836,
      "link": "https://stackoverflow.com/questions/23433836/azure-generating-rest-sdks-from-idl",
      "title": "Azure - generating REST SDKs from IDL"
    },
    {
      "tags": [
        "angularjs",
        "rest",
        "raml"
      ],
      "owner": {
        "reputation": 1117,
        "user_id": 1339087,
        "user_type": "registered",
        "accept_rate": 80,
        "profile_image": "https://www.gravatar.com/avatar/7b72123a28e4d5567e9d5f7f2b9b56ee?s=128&d=identicon&r=PG",
        "display_name": "Nikos",
        "link": "https://stackoverflow.com/users/1339087/nikos"
      },
      "is_answered": true,
      "view_count": 98,
      "answer_count": 1,
      "score": 0,
      "last_activity_date": 1396016921,
      "creation_date": 1396016533,
      "question_id": 22715481,
      "link": "https://stackoverflow.com/questions/22715481/angular-js-integration-with-the-in-browser-raml-parser",
      "title": "Angular.js integration with the in-browser RAML parser"
    },
    {
      "tags": [
        "rest",
        "swagger",
        "apiblueprint",
        "raml"
      ],
      "owner": {
        "reputation": 803,
        "user_id": 557869,
        "user_type": "registered",
        "accept_rate": 79,
        "profile_image": "https://www.gravatar.com/avatar/dd75fa8d754b882a16dbddb5bb1cad9f?s=128&d=identicon&r=PG",
        "display_name": "DeBuGGeR",
        "link": "https://stackoverflow.com/users/557869/debugger"
      },
      "is_answered": true,
      "view_count": 993,
      "accepted_answer_id": 22563014,
      "answer_count": 2,
      "score": 2,
      "last_activity_date": 1395415971,
      "creation_date": 1395322866,
      "question_id": 22534792,
      "link": "https://stackoverflow.com/questions/22534792/good-rest-code-generation-and-documentation-tool",
      "title": "Good rest code generation and documentation tool"
    },
    {
      "tags": [
        "api",
        "rest",
        "oauth-2.0",
        "raml"
      ],
      "owner": {
        "reputation": 1117,
        "user_id": 1339087,
        "user_type": "registered",
        "accept_rate": 80,
        "profile_image": "https://www.gravatar.com/avatar/7b72123a28e4d5567e9d5f7f2b9b56ee?s=128&d=identicon&r=PG",
        "display_name": "Nikos",
        "link": "https://stackoverflow.com/users/1339087/nikos"
      },
      "is_answered": true,
      "view_count": 792,
      "closed_date": 1389895734,
      "accepted_answer_id": 21143805,
      "answer_count": 2,
      "score": 4,
      "last_activity_date": 1394125765,
      "creation_date": 1389783299,
      "last_edit_date": 1394125765,
      "question_id": 21135492,
      "link": "https://stackoverflow.com/questions/21135492/how-to-use-raml-to-describe-an-api-using-oauth2",
      "closed_reason": "off-topic",
      "title": "How to use RAML to describe an API using OAuth2"
    },
    {
      "tags": [
        "rest",
        "mule",
        "synchronous"
      ],
      "owner": {
        "reputation": 24,
        "user_id": 2292162,
        "user_type": "registered",
        "accept_rate": 57,
        "profile_image": "https://www.gravatar.com/avatar/b489ce0d53f928c09f419ee994cdc562?s=128&d=identicon&r=PG",
        "display_name": "Nathan Weddle",
        "link": "https://stackoverflow.com/users/2292162/nathan-weddle"
      },
      "is_answered": true,
      "view_count": 472,
      "accepted_answer_id": 21512926,
      "answer_count": 1,
      "score": 1,
      "last_activity_date": 1391620741,
      "creation_date": 1390862344,
      "last_edit_date": 1391620741,
      "question_id": 21393192,
      "link": "https://stackoverflow.com/questions/21393192/mule-rest-apikit-my-flow-isnt-returning-a-messge-body",
      "title": "Mule REST APIKit- My flow isn't returning a messge body"
    },
    {
      "tags": [
        "rest",
        "delete",
        "mule",
        "raml"
      ],
      "owner": {
        "reputation": 24,
        "user_id": 2292162,
        "user_type": "registered",
        "accept_rate": 57,
        "profile_image": "https://www.gravatar.com/avatar/b489ce0d53f928c09f419ee994cdc562?s=128&d=identicon&r=PG",
        "display_name": "Nathan Weddle",
        "link": "https://stackoverflow.com/users/2292162/nathan-weddle"
      },
      "is_answered": true,
      "view_count": 128,
      "accepted_answer_id": 21392361,
      "answer_count": 1,
      "score": 1,
      "last_activity_date": 1390859175,
      "creation_date": 1390856069,
      "last_edit_date": 1390859175,
      "question_id": 21391464,
      "link": "https://stackoverflow.com/questions/21391464/mule-esb-apikit-rest-delete-method-can-i-force-mule-to-use-the-json-body-instea",
      "title": "Mule ESB APIKit REST DELETE Method- Can I force Mule to use the JSON body instead of the URI?"
    }
  ],
  "has_more": false,
  "quota_max": 10000,
  "quota_remaining": 9950
}

(only 6 items and has_more property is false).

If I use Stack Overflow search: stackoverflow.com/search?q=raml%20rest
I'm currently getting 18 results.

Am I missing something? Is this API method limited somehow?

(I tried to find something similar on these forums but wasn't able too).

1 Answer 1

2

The /search path and the /search/advanced path return only questions, not answers, and by design. It says so right in the doc pages:

Searches a site for any questions which fit the given criteria.

and

This method returns a list of questions.

Your example Stack Overflow search returned answers as well.
The correct equivalent search is:

stackoverflow.com/search?q=raml+rest+is%3Aquestion

-- which returns 6 results, the same as the API.



The good news is that, as of version 2.2, the API provides a new route, /search/excerpts, that does return answers also.

If you try it with your raml rest query, you'll see that it gives 18 results -- same as the Stack Overflow search.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .