weaver.fanfic.dev

Depending on which domain the service is accessed through, there may or may not be a /weaver prefix to these endpoints.

/weaver/v0/remote: Returns the client's remote address as seen by weaver. This is not json encoded -- it is a raw string. Ex:

127.0.0.1

/weaver/v0/status: Returns the status of the service, as well as the client's current burst request limit. If everything is well err should be 0 and status should be "ok". Ex:

{"burst":4,"err":0,"pid":101844,"status":"ok","tident":140189852665600}

/weaver/v0/ffn/crawl?q={url}[&apiKey={key}]: Crawl an ffn specific url. Url has http:// rewritten to https://, and the bare domain is rewritten to www.. It is an error to pass a url that does not start with https://(m|www).(ffn's domain). If a valid apiKey argument is not passed, then a aggressively rate limited anonymous one is used. If an apiKey is passed, it should be passed in the request body.

In general, if a response has a negative err code in a json body then there was an error issued by the api codebase. If there is a positive err code in a json body, then the error was issued by the application framework or web server and the numeric value will match the http status code.

status 200: body is simply proxied body. A few informative headers starting with X-Weaver- are included to identify the cached request and actually queried url. Upstream response headers are not included.

status 400: bad query, either missing the q query param or it is not a supported url. A json response body will be included, ex:

{"err":-1,"msg":"missing q param"}

{"arg":"foo","err":-2,"msg":"url is not ffn"}

status 401: unauthorized, ensure any required basic auth parameters are being passed. Ex:

{"err":401,"msg":"Unauthorized","nginx":true}

status 404: file not found, ensure the url is a valid api endpoint. Ex:

{"err":-404,"msg":"not found"}

status 429: too many requests; a Retry-After header will be included with minimum integer number of seconds before the client should make another request. A json response body with the same field will be included, ex:

{"err":-429,"msg":"too many requests","retryAfter":5}

status 500: internal server error. Either weaver is misconfigured, or there's an outage somewhere in the pipeline (possibly all FR instances are busy or down).