Page MenuHomeSoftware Heritage

Cover all accepted content types in Web API tests
Closed, MigratedEdits Locked

Description

The Software Heritage Web API accepts several content types when querying it.

Default one is JSON:

17:42 $ curl https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/
{"message":"Merge branch 'master' into pr/584\n","author":{"fullname":"Nicolas Dandrimont <nicolas.dandrimont@crans.org>","name":"Nicolas Dandrimont","email":"nicolas.dandrimont@crans.org"},"committer":{"fullname":"Nicolas Dandrimont <nicolas.dandrimont@crans.org>","name":"Nicolas Dandrimont","email":"nicolas.dandrimont@crans.org"},"date":"2014-08-18T18:18:25+02:00","committer_date":"2014-08-18T18:18:25+02:00","type":"git","directory":"9f2e5898e00a66e6ac11033959d7e05b1593353b","synthetic":false,"metadata":{},"parents":[{"id":"26307d261279861c2d9c9eca3bb38519f951bea4","url":"https://archive.softwareheritage.org/api/1/revision/26307d261279861c2d9c9eca3bb38519f951bea4/"},{"id":"37fc9e08d0c4b71807a4f1ecb06112e78d91c283","url":"https://archive.softwareheritage.org/api/1/revision/37fc9e08d0c4b71807a4f1ecb06112e78d91c283/"}],"id":"aafb16d69fd30ff58afdd69036a26047f3aebdc6","extra_headers":[],"merge":true,"url":"https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/","history_url":"https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/log/","directory_url":"https://archive.softwareheritage.org/api/1/directory/9f2e5898e00a66e6ac11033959d7e05b1593353b/"}

Data can also be dumped to YAML:

17:42 $ curl -H 'Accept: application/yaml' https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/
author:
  email: nicolas.dandrimont@crans.org
  fullname: Nicolas Dandrimont <nicolas.dandrimont@crans.org>
  name: Nicolas Dandrimont
committer:
  email: nicolas.dandrimont@crans.org
  fullname: Nicolas Dandrimont <nicolas.dandrimont@crans.org>
  name: Nicolas Dandrimont
committer_date: '2014-08-18T18:18:25+02:00'
date: '2014-08-18T18:18:25+02:00'
directory: 9f2e5898e00a66e6ac11033959d7e05b1593353b
directory_url: https://archive.softwareheritage.org/api/1/directory/9f2e5898e00a66e6ac11033959d7e05b1593353b/
extra_headers: []
history_url: https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/log/
id: aafb16d69fd30ff58afdd69036a26047f3aebdc6
merge: true
message: 'Merge branch ''master'' into pr/584

  '
metadata: {}
parents: !!python/tuple
- id: 26307d261279861c2d9c9eca3bb38519f951bea4
  url: https://archive.softwareheritage.org/api/1/revision/26307d261279861c2d9c9eca3bb38519f951bea4/
- id: 37fc9e08d0c4b71807a4f1ecb06112e78d91c283
  url: https://archive.softwareheritage.org/api/1/revision/37fc9e08d0c4b71807a4f1ecb06112e78d91c283/
synthetic: false
type: git
url: https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/

And there is also a documented HTML view when the endpoint is queried from a web browser:
https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/

Current tests for the different Web API endpoints only checks for JSON content type but YAML and HTML
should also be checked to catch possible issues with them.