Api schedule dayparting

I’m using API to set a schedule for my cms. When I set a fromDt and dayPartId:1 without assigning toDt, I receive an error:
“message”: “Can not have an end time earlier than your start time”,
and when I assign toDt, the dayPartId:1 doesn’t affect my schedule.

How can I just have toDt, and dayParting always?

If you’re using the “always” day part you shouldn’t need to provide date at all. Can you call the /daypart end point to make sure the always day part has the ID you’re expecting (its not always 1).

According to api documentation of adding a new schedule, if I put dayPartId value to 1 it will be day part always.
And API forces me to set fromDt as a required field and as I said before, it gave me an error if I don’t set a value for toDt.

OK we maybe need to improve that API documentation then - ideally the “Always” day part should be ID:1, but we cannot guarantee it.

Can you please check what is the always dayPartId on your CMS to be sure?

the only way is to make a request to /daypart ?

that is certainly the easiest way, if you already have an access token - if not the only other way is to view the day part page in the CMS with dev tools open on the Network tab and inspect the XHR request.

you were right, my daypartId for always was 2, for custom was 1. Thanks.

1 Like