Skip to content

Conversation

NMertsch
Copy link
Collaborator

@NMertsch NMertsch commented May 25, 2025

Summary

Pretalx updated their API and it broke our setup.
This PR fixes it, the YouTube integration was not tested (my token cannot access /p/youtube, so I used make all EXCLUDE=youtube)

Fixes #132

Details

API Changes

Nested resources

In the old API, nested resources were always embedded in the parent response body:

GET /speakers/<ID>
{
  ...
  answers: [
    {"id:" ..., "question": {...}, ...},
    ...
  ]
}

In the new API, nested resources are only referenced by their IDs:

GET /speakers/<ID>
{
  ...
  answers: [
    123,
    ...
  ]
}

The old behavior can be restored with the expand query:

GET /speakers/<ID>?expand=answers,answers.question
{
  ...
  answers: [
    {"id:" ..., "question": {...}, ...},
    ...
  ]
}

This PR adds expand queries where necessary.

Removed query ?questions=all

Previously, we used ?questions=all on the /submissions and speakers/ endpoints. This is not supported anymore. Answers and questions are now handled like all other nested resources (see above).

This PR removes these queries.

Schedule slots

Previously, the response to /schedule contained the keys slots and breaks:

  • slots contained all submission slots (talks, tutorials, ...) and contained objects of type "Submission"
  • breaks contained all non-submission slots (lunch and coffee breaks) and contained objects of another type
  • Both these object types contained the key slot with the slot details (time, location).

Previously, the responses to /submissions contained one slot object per submission (the first slot).

In the new version, /schedule only returns slots. The response objects contain the slot details (time, location), and an optional reference to the submission.
The responses to /submissions now contain slots (all slots) instead of slot (first slot).

This PR uses pydantic's BeforeValidators to re-arrange the data to the old format before deserialization.

Changed structure of localized names

Before:

GET /submissions/<ID>
{
  "track": {"en": "<NAME>"}
}

After:

GET /submissions/<ID>
{
  "track": {"name": {"en": "<NAME>"}}
}

This PR updates the deserialization logic for submission.track, submission.submission_type, and slot.room.

Renamed speaker.avatar to speaker.avatar_url

This PR updates the deserialization keyword, but keeps avatar in the transformation result.

@NMertsch NMertsch linked an issue May 25, 2025 that may be closed by this pull request
@NMertsch NMertsch marked this pull request as draft May 25, 2025 15:04
@NMertsch NMertsch force-pushed the 132-migrate-to-new-pretalx-api branch from 1bb206a to 628090d Compare May 25, 2025 15:12
@NMertsch NMertsch marked this pull request as ready for review May 25, 2025 15:13
@NMertsch NMertsch requested review from egeakman and artcz May 25, 2025 16:06
@NMertsch NMertsch marked this pull request as draft May 25, 2025 16:57
@NMertsch NMertsch marked this pull request as ready for review May 25, 2025 17:14
Copy link
Member

@egeakman egeakman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you so much Niklas!

@egeakman egeakman merged commit 5d8bf31 into ep2025 May 27, 2025
3 checks passed
@egeakman egeakman deleted the 132-migrate-to-new-pretalx-api branch May 27, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to new Pretalx API
2 participants