Solved

date is supported only when type is 'date'

  • 5 December 2023
  • 6 replies
  • 103 views

I am having issues with the Share API, I have the following payload:

{
"event_type": "https://api.calendly.com/event_types/5465e424-3294-4fb3-9de5-46a209a470fe",
"name": "30 Minute Meeting",
"duration": 60,
"period_type": "fixed",
"start_date": "2023-12-10",
"end_date": "2023-12-15",
"max_booking_time": 300,
"hide_location": true,
"location_configurations": [
{
"location": "123 Abc St.",
"additional_info": "Example additional information",
"position": 0,
"kind": "physical"
}
],
"availability_rule": {
"rules": [
{
"type": "wday",
"wday": "sunday",
"date": "2023-12-11",
"intervals": [
{
"from": "07:00",
"to": "11:00"
}
]
}
],
"timezone": "America/New_York"
}
}


But I keep receiving:

{
"details": [
{
"message": "date is supported only when type is 'date'",
"parameter": "date"
}
],
"message": "The supplied parameters are invalid.",
"title": "Invalid Argument"
}

When in the documentation, it specifically states:
 

start_date: string<date>

is required when period_type is 'fixed' Format: YYYY-MM-DD

Example:  2019-01-02

 

Anyone know what am I doing wrong?

icon

Best answer by anolson 5 December 2023, 15:53

View original

This topic has been closed for comments

6 replies

As a side note, your https://developer.calendly.com/api-docs/be9b32ef4b44c-get-access-token side tool is broken as well since it doesn’t include some required request parameters

Userlevel 1

Hi @liang-leapin

 

It looks like the request includes "date": "2023-12-11" in the availability rule, but the type there is set to `wday `. Could you try removing that date and see if it passes the validation. The docs for that endpoint are a little vague and could probably improved.

 

-andrew

Uh huh! Thanks @anolson !

Hey @anolson I am trying to authenticate with the following Curl command:

```

curl --location --request POST 'https://auth.calendly.com/oauth/token?grant_type=client_credentials' \
--header 'Authorization: Basic <base64 encryption of client_id:client_secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' 
```

It returns an `access_token` but when I use it on:

```
curl --request GET \ --url https://api.calendly.com/users/me \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json'
```

 

It returns:

```
{ "title": "Internal Server Error", "message": "The server encountered an unexpected condition that prevented it from fulfilling the request." }
```


When I do the same on my nodejs app, it says I am “Unauthenticated”
Do you know why this is happening?

I would also like to add that the tool on the right of this page https://developer.calendly.com/api-docs/be9b32ef4b44c-get-access-token doesn’t have he required parameters

Userlevel 1

Hey @liang-leapin

 

While you’ve found that it’s possible to generate a token with client_credentials, most endpoints don’t really support tokens created with that grant type. Can you try creating a token with the authorization_code grant type? Another option would be to create a PAT if you want to avoid going through the authorization code flow.

 

I made a note to fix the examples on the Get Access Token page. Thanks!