OokTech/TW5-Bob

Documentation for get-fetch-tiddlers incorrect

Closed this issue · 1 comments

Part 1 - The examples in the file Documentation/HTTPAPI/get-fetch-tiddlers.tid are incorrect.

Current:

  • /api/fetch?wiki=someWiki&filter=[tag[foo]]
  • /api/fetch?wiki=someOtherWiki&tiddler=tiddlerTitle

Should be:

  • /api/fetch/tiddlers?wiki=someWiki&filter=[tag[foo]]
  • /api/fetch/tiddlers?wiki=someOtherWiki&tiddler=tiddlerTitle

Part 2 - does the API method /api/fetch/tiddlers even support passing the &tiddler= parameter? In the source code I only see a test for wiki and filter params: if(params.filter && params.wiki) If it is not supported, it should be removed from the docs.

I've included a short Ruby used to test parts of the HTTP API.

require 'net/http'
require 'uri'
require 'json'

def get(uri)
  puts "\nGET #{uri}\n"
  res = Net::HTTP.get(uri)
  print "==> ", res[0..75]
  print "..." if res.length > 75
  puts "\n(#{res.length} bytes)"
  res
end

get URI("http://127.0.0.1:8080/api/list/wikis")
get URI("http://127.0.0.1:8080/api/status")
get URI("http://127.0.0.1:8080/api/fetch/list?wiki=a&filter=[all[shadows+tiddlers]]")
get URI("http://127.0.0.1:8080/api/fetch/tiddler/html?wiki=a&tiddler=Uno")
get URI("http://127.0.0.1:8080/api/fetch/tiddlers?wiki=a&filter=[tag[foo]]")
# Unsupported?
get URI("http://127.0.0.1:8080/api/fetch/tiddlers?wiki=a&tiddler=Uno")

And the output:

GET http://127.0.0.1:8080/api/list/wikis
==> {"wikis":["a"]}
(15 bytes)

GET http://127.0.0.1:8080/api/status
==> {"logged_in":false,"username":"","authentication_level":"Guest","tiddlywiki_...
(9234 bytes)

GET http://127.0.0.1:8080/api/fetch/list?wiki=a&filter=[all[shadows+tiddlers]]
==> {"list":["$:/Acknowledgements","$:/core/copyright.txt","$:/core/icon","$:/co...
(165610 bytes)

GET http://127.0.0.1:8080/api/fetch/tiddler/html?wiki=a&tiddler=Uno
==> <html><head><meta content="text/html;charset=utf-8" http-equiv="Content-Type...
(1665 bytes)

GET http://127.0.0.1:8080/api/fetch/tiddlers?wiki=a&filter=[tag[foo]]
==> {"list":["Uno"],"tiddlers":{"Uno":{"fields":{"title":"Uno","created":"2020-1...
(233 bytes)

GET http://127.0.0.1:8080/api/fetch/tiddlers?wiki=a&tiddler=Uno
==> 
(0 bytes)

closing: no longer of interest.