diff --git a/swh/web/api/apidoc.py b/swh/web/api/apidoc.py --- a/swh/web/api/apidoc.py +++ b/swh/web/api/apidoc.py @@ -295,7 +295,8 @@ doc_data = get_doc_data(f, route, noargs) return make_api_response(request, None, doc_data) - view_name = 'api-%s' % route[1:-1].replace('/', '-') + view_name = 'api-%s-%s' % \ + (api_version, route[1:-1].replace('/', '-')) APIUrls.add_url_pattern(urlpattern, doc_view, view_name) @wraps(f) diff --git a/swh/web/api/apiurls.py b/swh/web/api/apiurls.py --- a/swh/web/api/apiurls.py +++ b/swh/web/api/apiurls.py @@ -33,7 +33,7 @@ """ Add a route to the self-documenting API reference """ - route_view_name = 'api-%s' % route[1:-1].replace('/', '-') + route_view_name = 'api-1-%s' % route[1:-1].replace('/', '-') if route not in cls._apidoc_routes: d = {'docstring': docstring, 'route_view_name': route_view_name} diff --git a/swh/web/api/utils.py b/swh/web/api/utils.py --- a/swh/web/api/utils.py +++ b/swh/web/api/utils.py @@ -59,20 +59,20 @@ if 'target' in obj and 'target_type' in obj: if obj['target_type'] in ('revision', 'release', 'directory'): obj['target_url'] = \ - reverse('api-%s' % obj['target_type'], + reverse('api-1-%s' % obj['target_type'], url_args={'sha1_git': obj['target']}) elif obj['target_type'] == 'content': obj['target_url'] = \ - reverse('api-content', + reverse('api-1-content', url_args={'q': 'sha1_git:' + obj['target']}) elif obj['target_type'] == 'snapshot': obj['target_url'] = \ - reverse('api-snapshot', + reverse('api-1-snapshot', url_args={'snapshot_id': obj['target']}) if 'author' in obj: author = obj['author'] - obj['author_url'] = reverse('api-person', + obj['author_url'] = reverse('api-1-person', url_args={'person_id': author['id']}) return obj @@ -89,18 +89,18 @@ target_type = directory['type'] target = directory['target'] if target_type == 'file': - directory['target_url'] = \ - reverse('api-content', url_args={'q': 'sha1_git:%s' % target}) + directory['target_url'] = reverse( + 'api-1-content', url_args={'q': 'sha1_git:%s' % target}) if context_url: directory['file_url'] = context_url + directory['name'] + '/' elif target_type == 'dir': - directory['target_url'] = reverse('api-directory', - url_args={'sha1_git': target}) + directory['target_url'] = reverse( + 'api-1-directory', url_args={'sha1_git': target}) if context_url: directory['dir_url'] = context_url + directory['name'] + '/' else: - directory['target_url'] = reverse('api-revision', - url_args={'sha1_git': target}) + directory['target_url'] = reverse( + 'api-1-revision', url_args={'sha1_git': target}) if context_url: directory['rev_url'] = context_url + directory['name'] + '/' @@ -112,7 +112,7 @@ """ c = content.copy() - c['content_url'] = reverse('api-content', + c['content_url'] = reverse('api-1-content', url_args={'q': 'sha1:%s' % c['id']}) return c @@ -146,14 +146,15 @@ if hash_algo in checksums: q = '%s:%s' % (hash_algo, checksums[hash_algo]) if top_url: - content['content_url'] = reverse('api-content', url_args={'q': q}) - content['data_url'] = reverse('api-content-raw', url_args={'q': q}) - content['filetype_url'] = reverse('api-content-filetype', - url_args={'q': q}) - content['language_url'] = reverse('api-content-language', - url_args={'q': q}) - content['license_url'] = reverse('api-content-license', - url_args={'q': q}) + content['content_url'] = reverse( + 'api-1-content', url_args={'q': q}) + content['data_url'] = reverse('api-1-content-raw', url_args={'q': q}) + content['filetype_url'] = reverse( + 'api-1-content-filetype', url_args={'q': q}) + content['language_url'] = reverse( + 'api-1-content-language', url_args={'q': q}) + content['license_url'] = reverse( + 'api-1-content-license', url_args={'q': q}) return content @@ -166,32 +167,31 @@ revision: the revision as a dict """ - revision['url'] = reverse('api-revision', + revision['url'] = reverse('api-1-revision', url_args={'sha1_git': revision['id']}) - revision['history_url'] = reverse('api-revision-log', + revision['history_url'] = reverse('api-1-revision-log', url_args={'sha1_git': revision['id']}) if 'author' in revision: author = revision['author'] - revision['author_url'] = reverse('api-person', + revision['author_url'] = reverse('api-1-person', url_args={'person_id': author['id']}) if 'committer' in revision: committer = revision['committer'] - revision['committer_url'] = \ - reverse('api-person', url_args={'person_id': committer['id']}) + revision['committer_url'] = reverse( + 'api-1-person', url_args={'person_id': committer['id']}) if 'directory' in revision: - revision['directory_url'] = \ - reverse('api-directory', - url_args={'sha1_git': revision['directory']}) + revision['directory_url'] = reverse( + 'api-1-directory', url_args={'sha1_git': revision['directory']}) if 'parents' in revision: parents = [] for parent in revision['parents']: parents.append({ 'id': parent, - 'url': reverse('api-revision', url_args={'sha1_git': parent}) + 'url': reverse('api-1-revision', url_args={'sha1_git': parent}) }) revision['parents'] = parents @@ -199,13 +199,13 @@ if 'children' in revision: children = [] for child in revision['children']: - children.append(reverse('api-revision', - url_args={'sha1_git': child})) + children.append(reverse( + 'api-1-revision', url_args={'sha1_git': child})) revision['children_urls'] = children if 'message_decoding_failed' in revision: revision['message_url'] = \ - reverse('api-revision-raw-message', + reverse('api-1-revision-raw-message', url_args={'sha1_git': revision['id']}) return revision diff --git a/swh/web/api/views/content.py b/swh/web/api/views/content.py --- a/swh/web/api/views/content.py +++ b/swh/web/api/views/content.py @@ -17,7 +17,7 @@ @api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/filetype/', - 'api-content-filetype', checksum_args=['q']) + 'api-1-content-filetype', checksum_args=['q']) @api_doc('/content/filetype/') def api_content_filetype(request, q): """ @@ -62,7 +62,7 @@ @api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/language/', - 'api-content-language', checksum_args=['q']) + 'api-1-content-language', checksum_args=['q']) @api_doc('/content/language/') def api_content_language(request, q): """ @@ -108,7 +108,7 @@ @api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/license/', - 'api-content-license', checksum_args=['q']) + 'api-1-content-license', checksum_args=['q']) @api_doc('/content/license/') def api_content_license(request, q): """ @@ -151,7 +151,8 @@ enrich_fn=utils.enrich_metadata_endpoint) -@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/ctags/', 'api-content-ctags') +@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/ctags/', + 'api-1-content-ctags') @api_doc('/content/ctags/', tags=['hidden']) def api_content_ctags(request, q): """ @@ -164,7 +165,7 @@ enrich_fn=utils.enrich_metadata_endpoint) -@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/raw/', 'api-content-raw', +@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/raw/', 'api-1-content-raw', checksum_args=['q']) @api_doc('/content/raw/', handle_response=True) def api_content_raw(request, q): @@ -212,7 +213,7 @@ return response -@api_route(r'/content/symbol/(?P.+)/', 'api-content-symbol') +@api_route(r'/content/symbol/(?P.+)/', 'api-1-content-symbol') @api_doc('/content/symbol/', tags=['hidden']) def api_content_symbol(request, q=None): """Search content objects by `Ctags `_-style @@ -243,7 +244,7 @@ query_params['per_page'] = per_page result['headers'] = { - 'link-next': reverse('api-content-symbol', url_args={'q': q}, + 'link-next': reverse('api-1-content-symbol', url_args={'q': q}, query_params=query_params) } @@ -254,8 +255,8 @@ return result -@api_route(r'/content/known/search/', 'api-content-known', methods=['POST']) -@api_route(r'/content/known/(?P(?!search).*)/', 'api-content-known') +@api_route(r'/content/known/search/', 'api-1-content-known', methods=['POST']) +@api_route(r'/content/known/(?P(?!search).*)/', 'api-1-content-known') @api_doc('/content/known/', tags=['hidden']) def api_check_content_known(request, q=None): """ @@ -330,7 +331,7 @@ return response -@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/', 'api-content', +@api_route(r'/content/(?P[0-9a-z_:]*[0-9a-f]+)/', 'api-1-content', checksum_args=['q']) @api_doc('/content/') def api_content_metadata(request, q): diff --git a/swh/web/api/views/directory.py b/swh/web/api/views/directory.py --- a/swh/web/api/views/directory.py +++ b/swh/web/api/views/directory.py @@ -10,10 +10,10 @@ from swh.web.api.views.utils import api_lookup -@api_route(r'/directory/(?P[0-9a-f]+)/', 'api-directory', +@api_route(r'/directory/(?P[0-9a-f]+)/', 'api-1-directory', checksum_args=['sha1_git']) @api_route(r'/directory/(?P[0-9a-f]+)/(?P.+)/', - 'api-directory', + 'api-1-directory', checksum_args=['sha1_git']) @api_doc('/directory/') def api_directory(request, sha1_git, path=None): diff --git a/swh/web/api/views/identifiers.py b/swh/web/api/views/identifiers.py --- a/swh/web/api/views/identifiers.py +++ b/swh/web/api/views/identifiers.py @@ -15,7 +15,7 @@ @api_route(r'/resolve/(?P.*)/', - 'api-resolve-swh-pid') + 'api-1-resolve-swh-pid') @api_doc('/resolve/') def api_resolve_swh_pid(request, swh_id): """ diff --git a/swh/web/api/views/origin.py b/swh/web/api/views/origin.py --- a/swh/web/api/views/origin.py +++ b/swh/web/api/views/origin.py @@ -18,8 +18,8 @@ def _enrich_origin(origin): if 'id' in origin: o = origin.copy() - o['origin_visits_url'] = \ - reverse('api-origin-visits', url_args={'origin_id': origin['id']}) + o['origin_visits_url'] = reverse( + 'api-1-origin-visits', url_args={'origin_id': origin['id']}) return o return origin @@ -29,22 +29,22 @@ with_origin_url, with_origin_visit_url): ov = origin_visit.copy() if with_origin_url: - ov['origin_url'] = reverse('api-origin', + ov['origin_url'] = reverse('api-1-origin', url_args={'origin_id': ov['origin']}) if with_origin_visit_url: - ov['origin_visit_url'] = reverse('api-origin-visit', + ov['origin_visit_url'] = reverse('api-1-origin-visit', url_args={'origin_id': ov['origin'], 'visit_id': ov['visit']}) snapshot = ov['snapshot'] if snapshot: - ov['snapshot_url'] = reverse('api-snapshot', + ov['snapshot_url'] = reverse('api-1-snapshot', url_args={'snapshot_id': snapshot}) else: ov['snapshot_url'] = None return ov -@api_route(r'/origins/', 'api-origins') +@api_route(r'/origins/', 'api-1-origins') @api_doc('/origins/', noargs=True) def api_origins(request): """ @@ -92,14 +92,15 @@ if len(results) > origin_count: origin_from = results.pop()['id'] response['headers']['link-next'] = reverse( - 'api-origins', query_params={'origin_from': origin_from, - 'origin_count': origin_count}) + 'api-1-origins', + query_params={'origin_from': origin_from, + 'origin_count': origin_count}) return response -@api_route(r'/origin/(?P[0-9]+)/', 'api-origin') +@api_route(r'/origin/(?P[0-9]+)/', 'api-1-origin') @api_route(r'/origin/(?P[a-z]+)/url/(?P.+)/', - 'api-origin') + 'api-1-origin') @api_doc('/origin/') def api_origin(request, origin_id=None, origin_type=None, origin_url=None): """ @@ -179,7 +180,7 @@ @api_route(r'/origin/search/(?P.+)/', - 'api-origin-search') + 'api-1-origin-search') @api_doc('/origin/search/') def api_origin_search(request, url_pattern): """ @@ -235,7 +236,7 @@ query_params['regexp'] = regexp result['headers'] = { - 'link-next': reverse('api-origin-search', + 'link-next': reverse('api-1-origin-search', url_args={'url_pattern': url_pattern}, query_params=query_params) } @@ -248,7 +249,7 @@ @api_route(r'/origin/metadata-search/', - 'api-origin-metadata-search') + 'api-1-origin-metadata-search') @api_doc('/origin/metadata-search/', noargs=True, need_params=True) def api_origin_metadata_search(request): """ @@ -297,7 +298,7 @@ } -@api_route(r'/origin/(?P[0-9]+)/visits/', 'api-origin-visits') +@api_route(r'/origin/(?P[0-9]+)/visits/', 'api-1-origin-visits') @api_doc('/origin/visits/') def api_origin_visits(request, origin_id): """ @@ -377,7 +378,7 @@ query_params['per_page'] = per_page result['headers'] = { - 'link-next': reverse('api-origin-visits', + 'link-next': reverse('api-1-origin-visits', url_args={'origin_id': origin_id}, query_params=query_params) } @@ -390,7 +391,7 @@ @api_route(r'/origin/(?P[0-9]+)/visit/(?P[0-9]+)/', - 'api-origin-visit') + 'api-1-origin-visit') @api_doc('/origin/visit/') def api_origin_visit(request, origin_id, visit_id): """ diff --git a/swh/web/api/views/origin_save.py b/swh/web/api/views/origin_save.py --- a/swh/web/api/views/origin_save.py +++ b/swh/web/api/views/origin_save.py @@ -13,7 +13,7 @@ @api_route(r'/origin/save/(?P.+)/url/(?P.+)/', - 'api-save-origin', methods=['GET', 'POST'], + 'api-1-save-origin', methods=['GET', 'POST'], throttle_scope='swh_save_origin') @never_cache @api_doc('/origin/save/') diff --git a/swh/web/api/views/person.py b/swh/web/api/views/person.py --- a/swh/web/api/views/person.py +++ b/swh/web/api/views/person.py @@ -9,7 +9,7 @@ from swh.web.api.views.utils import api_lookup -@api_route(r'/person/(?P[0-9]+)/', 'api-person') +@api_route(r'/person/(?P[0-9]+)/', 'api-1-person') @api_doc('/person/') def api_person(request, person_id): """ diff --git a/swh/web/api/views/release.py b/swh/web/api/views/release.py --- a/swh/web/api/views/release.py +++ b/swh/web/api/views/release.py @@ -10,7 +10,7 @@ from swh.web.api.views.utils import api_lookup -@api_route(r'/release/(?P[0-9a-f]+)/', 'api-release', +@api_route(r'/release/(?P[0-9a-f]+)/', 'api-1-release', checksum_args=['sha1_git']) @api_doc('/release/') def api_release(request, sha1_git): diff --git a/swh/web/api/views/revision.py b/swh/web/api/views/revision.py --- a/swh/web/api/views/revision.py +++ b/swh/web/api/views/revision.py @@ -49,16 +49,16 @@ @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/log/', - 'api-revision-origin-log') + 'api-1-revision-origin-log') @api_route(r'/revision/origin/(?P[0-9]+)/log/', - 'api-revision-origin-log') + 'api-1-revision-origin-log') @api_route(r'/revision/origin/(?P[0-9]+)' r'/ts/(?P.+)/log/', - 'api-revision-origin-log') + 'api-1-revision-origin-log') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)' r'/ts/(?P.+)/log/', - 'api-revision-origin-log') + 'api-1-revision-origin-log') @api_doc('/revision/origin/log/') def api_revision_log_by(request, origin_id, branch_name='HEAD', @@ -147,7 +147,7 @@ query_params['per_page'] = per_page result['headers'] = { - 'link-next': reverse('api-revision-origin-log', url_args=params, + 'link-next': reverse('api-1-revision-origin-log', url_args=params, query_params=query_params) } @@ -160,22 +160,22 @@ @api_route(r'/revision/origin/(?P[0-9]+)/directory/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_route(r'/revision/origin/(?P[0-9]+)/directory/(?P.+)/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/directory/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/ts/(?P.+)/directory/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/directory/(?P.+)/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/ts/(?P.+)' r'/directory/(?P.+)/', - 'api-revision-origin-directory') + 'api-1-revision-origin-directory') @api_doc('/revision/origin/directory/', tags=['hidden']) def api_directory_through_revision_origin(request, origin_id, branch_name='HEAD', @@ -198,15 +198,15 @@ @api_route(r'/revision/origin/(?P[0-9]+)/', - 'api-revision-origin') + 'api-1-revision-origin') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/', - 'api-revision-origin') + 'api-1-revision-origin') @api_route(r'/revision/origin/(?P[0-9]+)' r'/branch/(?P.+)/ts/(?P.+)/', - 'api-revision-origin') + 'api-1-revision-origin') @api_route(r'/revision/origin/(?P[0-9]+)/ts/(?P.+)/', - 'api-revision-origin') + 'api-1-revision-origin') @api_doc('/revision/origin/') def api_revision_with_origin(request, origin_id, branch_name='HEAD', @@ -271,7 +271,7 @@ enrich_fn=utils.enrich_revision) -@api_route(r'/revision/(?P[0-9a-f]+)/', 'api-revision', +@api_route(r'/revision/(?P[0-9a-f]+)/', 'api-1-revision', checksum_args=['sha1_git']) @api_doc('/revision/') def api_revision(request, sha1_git): @@ -328,7 +328,7 @@ @api_route(r'/revision/(?P[0-9a-f]+)/raw/', - 'api-revision-raw-message', checksum_args=['sha1_git']) + 'api-1-revision-raw-message', checksum_args=['sha1_git']) @api_doc('/revision/raw/', tags=['hidden'], handle_response=True) def api_revision_raw_message(request, sha1_git): """Return the raw data of the message of revision identified by sha1_git @@ -342,9 +342,9 @@ @api_route(r'/revision/(?P[0-9a-f]+)/directory/', - 'api-revision-directory', checksum_args=['sha1_git']) + 'api-1-revision-directory', checksum_args=['sha1_git']) @api_route(r'/revision/(?P[0-9a-f]+)/directory/(?P.+)/', - 'api-revision-directory', checksum_args=['sha1_git']) + 'api-1-revision-directory', checksum_args=['sha1_git']) @api_doc('/revision/directory/') def api_revision_directory(request, sha1_git, dir_path=None, @@ -387,11 +387,11 @@ with_data=with_data) -@api_route(r'/revision/(?P[0-9a-f]+)/log/', 'api-revision-log', +@api_route(r'/revision/(?P[0-9a-f]+)/log/', 'api-1-revision-log', checksum_args=['sha1_git']) @api_route(r'/revision/(?P[0-9a-f]+)' r'/prev/(?P[0-9a-f]*/*)/log/', - 'api-revision-log', checksum_args=['sha1_git', 'prev_sha1s']) + 'api-1-revision-log', checksum_args=['sha1_git', 'prev_sha1s']) @api_doc('/revision/log/') def api_revision_log(request, sha1_git, prev_sha1s=None): """ @@ -464,7 +464,7 @@ query_params['per_page'] = per_page result['headers'] = { - 'link-next': reverse('api-revision-log', + 'link-next': reverse('api-1-revision-log', url_args={'sha1_git': new_last_sha1}, query_params=query_params) } diff --git a/swh/web/api/views/snapshot.py b/swh/web/api/views/snapshot.py --- a/swh/web/api/views/snapshot.py +++ b/swh/web/api/views/snapshot.py @@ -12,7 +12,7 @@ from swh.web.api.views.utils import api_lookup -@api_route(r'/snapshot/(?P[0-9a-f]+)/', 'api-snapshot', +@api_route(r'/snapshot/(?P[0-9a-f]+)/', 'api-1-snapshot', checksum_args=['snapshot_id']) @api_doc('/snapshot/') def api_snapshot(request, snapshot_id): @@ -109,7 +109,7 @@ if results['next_branch'] is not None: response['headers']['link-next'] = \ - reverse('api-snapshot', + reverse('api-1-snapshot', url_args={'snapshot_id': snapshot_id}, query_params={'branches_from': results['next_branch'], 'branches_count': branches_count, diff --git a/swh/web/api/views/stat.py b/swh/web/api/views/stat.py --- a/swh/web/api/views/stat.py +++ b/swh/web/api/views/stat.py @@ -8,7 +8,7 @@ from swh.web.api.apiurls import api_route -@api_route(r'/stat/counters/', 'api-stat-counters') +@api_route(r'/stat/counters/', 'api-1-stat-counters') @api_doc('/stat/counters/', noargs=True) def api_stats(request): """ diff --git a/swh/web/api/views/utils.py b/swh/web/api/views/utils.py --- a/swh/web/api/views/utils.py +++ b/swh/web/api/views/utils.py @@ -55,10 +55,10 @@ return Response({}, template_name='api/api.html') -APIUrls.add_url_pattern(r'^$', api_home, view_name='api-homepage') +APIUrls.add_url_pattern(r'^$', api_home, view_name='api-1-homepage') -@api_route(r'/', 'api-endpoints') +@api_route(r'/', 'api-1-endpoints') def api_endpoints(request): """Display the list of opened api endpoints. diff --git a/swh/web/api/views/vault.py b/swh/web/api/views/vault.py --- a/swh/web/api/views/vault.py +++ b/swh/web/api/views/vault.py @@ -32,7 +32,7 @@ @api_route(r'/vault/directory/(?P[0-9a-f]+)/', - 'api-vault-cook-directory', methods=['GET', 'POST'], + 'api-1-vault-cook-directory', methods=['GET', 'POST'], checksum_args=['dir_id'], throttle_scope='swh_vault_cooking') @never_cache @@ -83,13 +83,13 @@ dir_id, ['sha1'], 'Only sha1_git is supported.') res = _dispatch_cook_progress(request, 'directory', obj_id) - res['fetch_url'] = reverse('api-vault-fetch-directory', + res['fetch_url'] = reverse('api-1-vault-fetch-directory', url_args={'dir_id': dir_id}) return res @api_route(r'/vault/directory/(?P[0-9a-f]+)/raw/', - 'api-vault-fetch-directory', + 'api-1-vault-fetch-directory', checksum_args=['dir_id']) @api_doc('/vault/directory/raw/', handle_response=True) def api_vault_fetch_directory(request, dir_id): @@ -123,7 +123,7 @@ @api_route(r'/vault/revision/(?P[0-9a-f]+)/gitfast/', - 'api-vault-cook-revision_gitfast', methods=['GET', 'POST'], + 'api-1-vault-cook-revision_gitfast', methods=['GET', 'POST'], checksum_args=['rev_id'], throttle_scope='swh_vault_cooking') @never_cache @@ -175,13 +175,13 @@ rev_id, ['sha1'], 'Only sha1_git is supported.') res = _dispatch_cook_progress(request, 'revision_gitfast', obj_id) - res['fetch_url'] = reverse('api-vault-fetch-revision_gitfast', + res['fetch_url'] = reverse('api-1-vault-fetch-revision_gitfast', url_args={'rev_id': rev_id}) return res @api_route(r'/vault/revision/(?P[0-9a-f]+)/gitfast/raw/', - 'api-vault-fetch-revision_gitfast', + 'api-1-vault-fetch-revision_gitfast', checksum_args=['rev_id']) @api_doc('/vault/revision/gitfast/raw/', handle_response=True) def api_vault_fetch_revision_gitfast(request, rev_id): diff --git a/swh/web/assets/src/bundles/browse/origin-search.js b/swh/web/assets/src/bundles/browse/origin-search.js --- a/swh/web/assets/src/bundles/browse/origin-search.js +++ b/swh/web/assets/src/bundles/browse/origin-search.js @@ -90,7 +90,7 @@ let baseSearchUrl; let searchMetadata = $('#swh-search-origin-metadata').prop('checked'); if (searchMetadata) { - baseSearchUrl = Urls.api_origin_metadata_search() + `?fulltext=${patterns}`; + baseSearchUrl = Urls.api_1_origin_metadata_search() + `?fulltext=${patterns}`; } else { originPatterns = patterns; let patternsArray = patterns.trim().replace(/\s+/g, ' ').split(' '); @@ -137,7 +137,7 @@ offset = 0; inSearch = true; // first try to resolve a swh persistent identifier - let resolvePidUrl = Urls.api_resolve_swh_pid(patterns); + let resolvePidUrl = Urls.api_1_resolve_swh_pid(patterns); fetch(resolvePidUrl) .then(handleFetchError) .then(response => response.json()) diff --git a/swh/web/assets/src/bundles/vault/vault-create-tasks.js b/swh/web/assets/src/bundles/vault/vault-create-tasks.js --- a/swh/web/assets/src/bundles/vault/vault-create-tasks.js +++ b/swh/web/assets/src/bundles/vault/vault-create-tasks.js @@ -18,9 +18,9 @@ }) === undefined) { let cookingUrl; if (cookingTask.object_type === 'directory') { - cookingUrl = Urls.api_vault_cook_directory(cookingTask.object_id); + cookingUrl = Urls.api_1_vault_cook_directory(cookingTask.object_id); } else { - cookingUrl = Urls.api_vault_cook_revision_gitfast(cookingTask.object_id); + cookingUrl = Urls.api_1_vault_cook_revision_gitfast(cookingTask.object_id); } if (cookingTask.email) { cookingUrl += '?email=' + cookingTask.email; diff --git a/swh/web/assets/src/bundles/vault/vault-ui.js b/swh/web/assets/src/bundles/vault/vault-ui.js --- a/swh/web/assets/src/bundles/vault/vault-ui.js +++ b/swh/web/assets/src/bundles/vault/vault-ui.js @@ -72,9 +72,9 @@ // build cook request url let cookingUrl; if (recookTask.object_type === 'directory') { - cookingUrl = Urls.api_vault_cook_directory(recookTask.object_id); + cookingUrl = Urls.api_1_vault_cook_directory(recookTask.object_id); } else { - cookingUrl = Urls.api_vault_cook_revision_gitfast(recookTask.object_id); + cookingUrl = Urls.api_1_vault_cook_revision_gitfast(recookTask.object_id); } if (recookTask.email) { cookingUrl += '?email=' + recookTask.email; @@ -124,9 +124,9 @@ tasks[cookingTask.object_id] = cookingTask; let cookingUrl; if (cookingTask.object_type === 'directory') { - cookingUrl = Urls.api_vault_cook_directory(cookingTask.object_id); + cookingUrl = Urls.api_1_vault_cook_directory(cookingTask.object_id); } else { - cookingUrl = Urls.api_vault_cook_revision_gitfast(cookingTask.object_id); + cookingUrl = Urls.api_1_vault_cook_revision_gitfast(cookingTask.object_id); } if (cookingTask.status !== 'done' && cookingTask.status !== 'failed') { cookingTaskRequests.push(fetch(cookingUrl)); diff --git a/swh/web/templates/api/api.html b/swh/web/templates/api/api.html --- a/swh/web/templates/api/api.html +++ b/swh/web/templates/api/api.html @@ -14,7 +14,7 @@ {% endblock %} {% block content %} -
+
{% include 'includes/apidoc-header.html' %}