Booking for particular user

Hello, I’m trying to set up booking via API.

Here is a sample request:
{
“startsAt”: “2021-07-28T08:00:00”,
“timeZone”: “US/Central”,
“units”: 1,
“numberOfSlots”: 1,
“answers”: [
{
“code”: “EMAIL”,
“string”: “ben1+apitest@testemail.com
},
{
“code”: “FNAME”,
“string”: “Ben1”
},
{
“code”: “LNAME”,
“string”: “Test1”
},
{
“code”: “PHONE”,
“string”: “9544501276”
},
{
“code”: “ZIP”,
“string”: “33309”
}
]
}

Now I want this booking to be assigned to a particular user from the team. How do I go about that? I have user’s email.

@Benson welcome to the Forum.

You will need to also pass in:
​"teamMember":{
“id”: “{TEAMMEMBERID}”}

​Replace {TEAMMEMBERID} with the ID number for the team member you want to book with.

​You can run a GET for the current booking page and it will list the ?fields=teamMembers,teamMembers.items,teamMembers.items.name,teamMembers.items.id

I’m trying for the last one hour to get team member ID.

can you please post the sample request on how to get teammeberID?
I did not understand how to run GET for the current booking page.

this is what I did and failed:
POST : https://api.youcanbook.me/v1/{MyAccountID}/profiles/{MyProfileId}/bookings

REQUEST :

{
“startsAt”: “2021-07-30T08:00:00”,
“timeZone”: “US/Central”,
“units”: 1,
“numberOfSlots”: 1,
“answers”: [
{
“code”: “EMAIL”,
“string”: “ben1+apitest@testemail.com
},
{
“code”: “FNAME”,
“string”: “Ben1”
},
{
“code”: “LNAME”,
“string”: “Test1”
},
{
“code”: “PHONE”,
“string”: “9544501276”
},
{
“code”: “ZIP”,
“string”: “33309”
}
],
“teamMember”: {
“id”: “695442”
}
}

RESPONSE :
{
“code”: “ycbm_api_profile_team_member_unknown”,
“message”: “Unknown team member”,
“type”: “YcbmApiException”,
“errors”: [],
“httpCode”: 400
}

I know MemberId is wrong now, but where do I get that?

Ok, I got it.
I did GET a request on
https://api.youcanbook.me/v1/{AccountId}/profiles/{ProfileId}/?fields=teamMembers,teamMembers.items,teamMembers.items.name,teamMembers.items.id

and I did get a successful response. and after using that Id I was able to create a booking successfully.

Thank you so much for the help.

1 Like

@Benson Awesome I am glad you were able to get it sorted!