Skip to content

[API] Use UUID instead of URL for relations #188

@gnuletik

Description

@gnuletik

I'm trying to create an analysis track and I've seen that in order to create it, I need to provide an analysis and an item as seen here : https://timeside.ircam.fr/api/docs/#operation/createAnalysisTrack.

If I provide the UUID for the analysis and the item in the request I get an "Invalid hyper - No URL match" error

curl
   -X POST
   -H 'Authorization: Bearer XXX'
   -H 'Content-Type: application/json'
   -d '{"analysis": "a2f004da-1966-4734-b263-baddcefaa824", "item": "f819b56c-e4c4-4762-83ac-77eb81084268"}'
   'https://sandbox.wasabi.telemeta.org/timeside/api/analysis_tracks/'

{"analysis":["Invalid hyperlink - No URL match."],"item":["Invalid hyperlink - No URL match."]

If I provide the URL instead of the UUID in the JSON body, it works

curl
    -X POST
    -H 'Authorization: Bearer XXX'
    -H 'Content-Type: application/json'
    -d '{"analysis": "https://sandbox.wasabi.telemeta.org/timeside/api/analysis/a2f004da-1966-4734-b263-baddcefaa824/", "item": "https://sandbox.wasabi.telemeta.org/timeside/api/items/f819b56c-e4c4-4762-83ac-77eb81084268/"}'
    'https://sandbox.wasabi.telemeta.org/timeside/api/analysis_tracks/'

This usage has two issues IMO:

  1. Using an URL to reference the item is not really convenient from a developer point a view as one wouldn't pass the URL and the UUID across its app. So, one should re-build the entry's URL where one wants to make an API call. We may solve this by replacing the hyperlink with uuid.

  2. The field is not explicit inside the serializer / schema / docs. We may add a suffix where url or uuid is used (e.g. item_url or item_uuid, analysis_url or analysis_uuid). We may also add a help text in the schema for the docs.

What's your thoughts ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions