Bird
0
0

You need to design a webhook registration endpoint that prevents duplicate registrations for the same callback_url. Which approach is best?

hard📝 Application Q8 of 15
Rest API - Webhooks and Events

You need to design a webhook registration endpoint that prevents duplicate registrations for the same callback_url. Which approach is best?

ACheck if <code>callback_url</code> exists in storage before adding; return 409 Conflict if duplicate
BStore each registration without checking duplicates; handle duplicates later
CAllow duplicates but send warning in response
DIgnore duplicates silently and always return 201 Created
Step-by-Step Solution
Solution:
  1. Step 1: Understand duplicate registration issues

    Duplicates can cause repeated event notifications or wasted resources.
  2. Step 2: Use proper HTTP status for duplicates

    Checking storage and returning 409 Conflict prevents duplicates clearly and correctly.
  3. Final Answer:

    Check if callback_url exists in storage before adding; return 409 Conflict if duplicate -> Option A
  4. Quick Check:

    Prevent duplicates with 409 Conflict response [OK]
Quick Trick: Use 409 Conflict to reject duplicate webhook URLs [OK]
Common Mistakes:
MISTAKES
  • Ignoring duplicates until later
  • Allowing duplicates silently
  • Using 201 Created for duplicates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes