Target release

Epic

New FeatureAPI-12 - New Search API Endpoint ToS;DR Received

Document status

DRAFT

Document owner

@a user

Designer

@a user

Tech lead

@a user

Technical writers

@a user

QA

🎯 Objective

Goal is to create a new Service Endpoint using our new Serverless Functions K3S Cluster.

📊 Success metrics

Goal

Metric

Deploy Serverless Function

🤔 Assumptions

v5 Endpoint

🗒 Requirements

Requirement

User Story

Importance

Jira Issue

Notes

Publicly Accessible

The Search Endpoint contains no sensitive data

HIGH

 

 

 

 

 

🎨 Request Structure

https://api.tosdr.org/search/v5/?q=QUERY&page=PAGINATION_INDEX
CODE

The q Parameter holds the Search Query we pass onto Elastic Search.

The page Parameter holds the pagination index. To retrieve pagination metadata, look for the _page Key in the Response Model.

🎨 Response Model

{
	"error": 256,
	"message": "Search Results below",
	"parameters": {
		"_page": {
			"total": 6130,
			"current": 1,
			"start": 1,
			"end": 62
		},
		"services": [{
			"id": 440,
			"is_comprehensively_reviewed": 0,
			"name": "pebble",
			"status": null,
			"urls": ["pebble.com"],
			"updated_at": {
				"timezone": "Europe\/Berlin",
				"pgsql": "2021-03-25T03:19:30.208Z",
				"unix": 1616642370
			},
			"created_at": {
				"timezone": "Europe\/Berlin",
				"pgsql": "2018-05-08T12:19:44.833Z",
				"unix": 1525781984
			},
			"slug": null,
			"rating": {
				"hex": "N\/A",
				"human": "Grade N\/A",
				"letter": "N\/A"
			},
			"links": {
				"phoenix": {
					"service": "https:\/\/edit.tosdr.org\/services\/440",
					"documents": "https:\/\/edit.tosdr.org\/services\/440\/annotate",
					"new_comment": "https:\/\/edit.tosdr.org\/services\/440\/service_comments\/new",
					"edit": "https:\/\/edit.tosdr.org\/services\/440\/edit"
				},
				"crisp": {
					"api": "https:\/\/api.tosdr.org\/service\/v1\/?service=440",
					"service": "https:\/\/tosdr.org\/en\/service\/440",
					"badge": {
						"svg": "https:\/\/shields.tosdr.orgen_440.svg",
						"png": "https:\/\/shields.tosdr.orgen_440.png"
					}
				}
			}
		}]
	}
}
JSON

The Response Model should be equal to the service v1 endpoint

(question) Open Questions

Question

Answer

Date Answered

Can we implement Pagination with the Elastic Query?

We can use the FROM parameter in the elastic query, equal to the OFFSET sql query

(warning) Out of Scope