I want to add a phone number to a person if it is not already added.
I tried using the /persons/find endpoint to get a person by email, then to check if the specific phone number already exists for the person or not. However, it seems like that endpoint is just returning a single phone number (the primary one), is this correct? If so, why doesn’t return the person in the same format as /persons/{id}?
So to solve my scenario the only way I see is this:
- Find person using email address
- Get person using the id returned in step 1
- Check if any of the person’s phone number matches the number in question
- If no match: Use persons endpoint (PUT) to add phone number
Is this correct, or is there a smarter way?