Skip to content
Jim Rootham edited this page Feb 27, 2023 · 8 revisions

API end points

They all use https:// and GET and all but the attachment return JSON.

Constants

These have no arguments

/toronto-bids/api/types => [{id:int, type:string}]

/toronto-bids/api/commodities => [{id:int, commodity:string}]

/toronto-bids/api/commodity_types => [{id:int, commodity_id:int, commodity_type:string}]

/toronto-bids/api/divisions => [{id:int,division:string}]

/toronto-bids/api/buyers => [{id:int, name:string}]

Document List

/toronto-bids/api/documents (call_number=string, type=string, division=string, commodity=string, commodity_type=string, posting_date_after=string, posting_date_before=string, closing_date_after=string, closing_date_before=string, buyer=string, search_text=string, limit=int, offset=int) => [{document_id:int, type:string, call_number:string, commodity:string, commodity_type:string, short_description:string, posting_date:yyyy/mm/dd, closing_date:yyyy/mm/dd, site_meeting:string, [{buyer:string, location:string}]}]

All the arguments for documents are optional.

The search_text string does a full text search on short_description, description, and all the attached files using the following format:

A leading plus sign (+) indicates that this word must be present in each row that is returned.

A leading minus sign (-) indicates that this word must not be present in any of the rows that are returned.

Note: The - operator acts only to exclude rows that are otherwise matched by other search terms. Thus, a boolean-mode search that contains only terms preceded by - returns an empty result. It does not return “all rows except those containing any of the excluded terms.”

By default (when neither + nor - is specified), the word is optional, but the rows that contain it are rated higher. This mimics the behavior of MATCH() AGAINST() without the IN BOOLEAN MODE modifier.

The @distance operator tests whether two or more words all start within a specified distance from each other, measured in words. Specify the search words within a double-quoted string immediately before the @distance operator, for example, MATCH(col1) AGAINST('"word1 word2 word3" @8' IN BOOLEAN MODE)

The > or < operators are used to change a word's contribution to the relevance value that is assigned to a row. The > operator increases the contribution and the < operator decreases it.

Parentheses ( ) group words into subexpressions. Parenthesized groups can be nested.

A leading tilde (~) acts as a negation operator, causing the word's contribution to the row's relevance to be negative. This is useful for marking “noise” words. A row containing such a word is rated lower than others, but is not excluded altogether, as it would be with the - operator.

The asterisk (*) serves as the truncation (or wildcard) operator. Unlike the other operators, it is appended to the word to be affected. Words match if they begin with the word preceding the * operator.

If a word is specified with the truncation operator, it is not stripped from a boolean query, even if it is too short or a stopword. Whether a word is too short is determined from the innodb_ft_min_token_size setting for InnoDB tables, or ft_min_word_len for MyISAM tables. These options are not applicable to FULLTEXT indexes that use the ngram parser.

The wildcarded word is considered as a prefix that must be present at the start of one or more words. If the minimum word length is 4, a search for '+word +the*' could return fewer rows than a search for '+word +the', because the second query ignores the too-short search term the.

A phrase that is enclosed within double quote (") characters matches only rows that contain the phrase literally, as it was typed. The full-text engine splits the phrase into words and performs a search in the FULLTEXT index for the words. Nonword characters need not be matched exactly: Phrase searching requires only that matches contain exactly the same words as the phrase and in the same order. For example, "test phrase" matches "test, phrase".

Document Details

/toronto-bids/api/description (document_id=int) => {description:string}

/toronto-bids/api/attachments(document_id=int, limit=int, offset=int) [{title:string, url:string}]}

The limit and offset arguments are optional in attachments.

The attachment URL is designed to be an href target in a link. This is the format of the url field in the attachments payload.

/toronto-bids/api/attachment/document_id/filename

Clone this wiki locally