swh.web.api.views.citation module#
- class swh.web.api.views.citation.CitationOriginQuerySerializer(*args, **kwargs)[source]#
- Bases: - Serializer- Origin citation query parameters serializer. - When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object. 
- class swh.web.api.views.citation.CitationSWHIDQuerySerializer(*args, **kwargs)[source]#
- Bases: - Serializer- SWHID citation query parameters serializer. - When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object. 
- swh.web.api.views.citation.api_raw_intrinsic_citation_origin_get(request: Request, validated_query_params: dict[str, str])[source]#
- GET /api/1/raw-intrinsic-metadata/citation/origin/#
- Get a software citation, given a format (only currently supported format is BibTeX) and a software origin. This citation will refer to the latest visit snapshot version of the main branch of the software repository. - Query Parameters:
- citation_format (string) – the citation expected format (currently bibtex) 
- origin_url (string) – the URL of the software origin 
 
- Response JSON Object:
- format (string) – citation format (currently bibtex) 
- content (string) – formatted string representing the software citation content in the expected format 
- source_swhid (string) – qualified SWHID for citation metadata source file 
- source_url (string) – link to raw bytes of citation metadata source file 
 
- Request Headers:
- Accept – the requested response content type, either - application/json(default) or- application/yaml
 
- Response Headers:
- Content-Type – this depends on Accept header of request 
 
- Status Codes:
- 200 OK – no error 
- 400 Bad Request – the requested software origin is invalid 
- 404 Not Found – the requested software origin cannot be found in the archive or metadata for citation is missing, or citation is empty 
 
 - Example: - https://archive.softwareheritage.org/api/1/raw-intrinsic-metadata/citation/origin/?citation_format=bibtex&origin_url=https://github.com/rdicosmo/parmap 
 
- swh.web.api.views.citation.api_raw_intrinsic_citation_swhid_get(request: Request, validated_query_params: dict[str, str])[source]#
- GET /api/1/raw-intrinsic-metadata/citation/swhid/#
- Get a software citation, given an object SWHID and a format (only currently supported format is BibTeX). - Query Parameters:
- citation_format (string) – the citation expected format (currently bibtex) 
- target_swhid (string) – the SWHID, with or without qualifiers, of the software object to cite 
 
- Response JSON Object:
- format (string) – citation format (currently bibtex) 
- content (string) – formatted string representing the software citation content in the expected format 
- source_swhid (string) – qualified SWHID for citation metadata source file 
- source_url (string) – link to raw bytes of citation metadata source file 
 
- Request Headers:
- Accept – the requested response content type, either - application/json(default) or- application/yaml
 
- Response Headers:
- Content-Type – this depends on Accept header of request 
 
- Status Codes:
- 200 OK – no error 
- 400 Bad Request – the requested software origin is invalid 
- 404 Not Found – the requested software origin cannot be found in the archive or metadata for citation is missing, or citation is empty 
 
 - Example: - https://archive.softwareheritage.org/api/1/raw-intrinsic-metadata/citation/swhid/?citation_format=bibtex&target_swhid=swh:1:dir:2dc0f462d191524530f5612d2935851505af41dd;origin=https://github.com/rdicosmo/parmap;visit=swh:1:snp:2128ed4f25f2d7ae7c8b7950a611d69cf4429063