JSON search

Hi,

I would like to search a service that makes the results available in JSON and I suppose the last section on plugin XML and JSON Keys “JSON-SPECIFIC KEYS” in the manual deals with this but I am not getting it to work. Are there any examples of “JSON key paths”? I used the relative paths but one complication is that the second level is an array (i.e. [{… ). Or am I completely misunderstanding the capabilities of Devonagent to handle JSON results? If so, is there any other way to get it into Devonagent/Devonthink, e.g. parsing in the form of a feed?

Thanks,
Christian

DEVONagent supports also feeds. Could you post the URL of the service or a JSON output of the service?

Hi,

Thanks for your quick reply. Sure, here’s the url for the json service that I would like to use: auctionet.com/api/v2/items.json … =50&page=1

As you can see it’s the following structure:
{“items”:
[{…
“title”:…,
“description”:…,
“url”:…

etc.

Here’s a simple plugin:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Description</key>
	<string></string>
	<key>DescriptionsKeyPath</key>
	<string>description</string>
	<key>EngineUrl</key>
	<string>https://auctionet.com/api/v2/items.json?locale=en&amp;q=_agentQuery_&amp;per_page=_agentNumber_&amp;page=_agentOffset_</string>
	<key>Identifier</key>
	<string>auctionet.com</string>
	<key>Info</key>
	<string>auctionet.com Plugin</string>
	<key>LinksKeyPath</key>
	<string>url</string>
	<key>Name</key>
	<string>auctionet.com</string>
	<key>OffsetPerPage</key>
	<integer>1</integer>
	<key>Operators</key>
	<integer>59</integer>
	<key>PostScan</key>
	<false/>
	<key>ResultsKeyPath</key>
	<string>items</string>
	<key>ResultsPerPage</key>
	<integer>50</integer>
	<key>SkipsCrawling</key>
	<true/>
	<key>Start</key>
	<integer>1</integer>
	<key>ThumbnailsKeyPath</key>
	<string>images[0].w640</string>
	<key>TitlesKeyPath</key>
	<string>title</string>
	<key>Version</key>
	<string>1.0</string>
</dict>
</plist>

Notes:

  1. The plugin uses larger thumbnails (w640), therefore you could switch to CoverFlow to easily preview all results.
  2. The plugin accepts all results (PostScan is false) and doesn’t check whether the results match the query term.

Perfect! Thanks. It was the ThumbnailsKeyPath that I got wrong which led to no results being displayed at all. An idea might be to make it fail a bit more “gracefully”, i.e. as if the key isn’t set, to make plugin development easier.

Anyhow, now I know how it handles wrong paths so will try with as few keys as possible to start with if I need to use the JSON keys again.

Thanks.

Only LinksKeyPath is always required, in this case also ResultsKeyPath. But as the plugin skips crawling, the DescriptionsKeyPath and ThumbnailsKeyPath are of course important too.