I’ve updated the PoshCode script module to support CTP3, and added a -limit parameter to the Get-PoshCode cmdlet so you can specify how many items you want retrieved in the case where there are a lot of matches for your search terms — by default the limit is 25.

Improvements to the underlying web search API

You’ve always been able to pass a LIST parameter to the API, and get more results by specifying a higher number. But it never worked with the “path” notation (until now).

That is, you used to be able to do:

  • http://poshcode.org/api1?q=start&list=10
  • http://poshcode.org/api1?q=start&list=100

To make the API a little easier to use I’ve enhanced it just now:

  1. You can now page the search results.
  2. You can use the word “limit” instead of “list”
  3. If you specify limit=0 (or list=0) I’ll give you everything I’ve got. Please use a little precaution about that, as it could be a LOT of data. I’d much rather you retrieve, say … 25, and then get the second page if you want more.
  1. You can use path notation.

So, you can use any of these URLs:

  • http://poshcode.org/api1/start/list/25/page/1
  • http://poshcode.org/api1/start/limit/25/page/2
  • http://poshcode.org/api1?q=start&list=25&page=3
  • http://poshcode.org/api1?q=start&limit=25&page=4

There are a lot of search results for “start” ... feel free to play with enhancing the PoshCode module, or incorporating this into your apps, etc.

[new] I should add that you don’t have to specify the limit or page number. By default you’ll get the first 10 items, which should be enough. :)

Comments are closed.