# Go Performance Data Server

The Go Performance Data Server allows upload and querying of benchmark results in the standard benchmark data format. It provides a RESTful API to upload benchmark results and query individual results.

## API Documentation

### POST /upload

A POST request to this URL with multipart/form-data contents. The form should contain a single field, "file", and the other MIME components are the uploaded files in benchmark format. The request is authenticated with OAuth. Upon success, it will return a JSON body that identifies the uploaded records:

    {
    	"uploadid": "arbitrary-string",
    	"fileids": [
    		"arbitrary-string-1",
    		"arbitrary-string-2"
    	],
    	"viewurl": "https://foo/bar",
    }

The upload ID may be used in a query as "upload:$uploadid" to find the uploaded data, and each file ID may be used in a query as "upload-part:$fileid". The view URL is optional and if present points to a human-readable page for analysing the uploaded benchmark data.

Errors will be returned as HTTP errors with a plain text error message.

As a convenience for testing, GET on /upload will render an HTML form that can be used for initiating an upload.

### GET /search?q=$search

A GET request to this URL will return a text file with synthesized benchmark results matching the search. The search string contains space-separated "key:value" pairs which limits the results to only records containing those exact fields. Every "key:value" pair is ANDed together, and each value must be matched exactly, with no regexes or substring matches supported. The operators ">" and "<" may be used instead of ":" to perform a range query. Example searches:

- by:rsc pkg:compress/flate commit:1234
- upload-part:4567
- upload:123
- commit-time>2016-12-01

### GET /uploads?q=$search&extra_label=$label&limit=$limit

A GET request to this URL returns a list of the most recent `$limit` uploads that match the search string. If the `q` parameter is omitted, all uploads will be returned. If the `limit` parameter is omitted, a server-specified limit is used. If the `extra_label` parameter is supplied, an arbitrary value for that label will be chosen from the upload's records. (Therefore, this is most useful for labels that do not vary across the upload, such as "by" or "upload-time".)

The result of this query is streaming JSON (readable using >json.NewDecoder), with one JSON entity per upload:

    {
    	"Count": 10,
    	"UploadID": "arbitrary-string",
    	"LabelValues": {
    		"by": "user@email.com",
    		"upload-time": "2006-01-02T15:04:05Z",
    	}
    }