Setting Start & Enddate in Calender API-Calls


#1

Observed Behavior:
When calling Conduit calender.edit and adding a start/end Transaction, instead of creating/editing the Calendar Entry i get the following error message:

Unhandled Exception (“Error”)
Call to a member function isValid() on integer

Im running the following CURL call:

curl $PHABRICATOR_SERVER/api/calendar.event.edit
-d api.token="$PHABRICATOR_TOKEN"
-d transactions[0][type]=“name”
-d transactions[0][value]=“my calender entry”
-d transactions[1][type]=“description”
-d transactions[1][value]=“this is the best calendar entry in the world”
-d transactions[2][type]=“icon”
-d transactions[2][value]=“travel”
-d transactions[3][type]=“start”
-d transactions[3][value]="$(date +%s)"
-d transactions[4][type]=“end”
-d transactions[4][value]="$(date --date=’+2 hours’ +%s)"
-d transactions[5][type]=“projects.add”
-d transactions[5][value][0]=“PHID-PROJ-vj3fshi53uervwu6t3jl”

so the start/end-Date are sent as Integers of the Unix Epoch. As soon as I remove them the calender entry gets created with the default times.

Expected Behavior:
Phabricator should be accepting the date and create the calendar event based on the start/end-Date. If the API is not intended to be called with the Unix Epoch like i assumed, it would be nice to have some additional Documentation (i.E. in Conduit) for how to construct Date Objects for Phabricator API consumption.

Phabricator Version:
phabricator 52fff638ca9bb0f7c48791475930a51ae61a1016 (Sep 19 2017) (branched from bd923d1ce0914f587a8ef5ad1a4f171b52cc4925 on origin)

arcanist c67dcb00a4db2640f310e4face977ad9de5d1e42 (Sep 15 2017) (branched from df81d79d77f89dfd27529a10c2a0aab6020638c5 on origin)

phutil a5dc164021c767ff02d58a73f9588d1da3bd8eb3 (Sep 15 2017) (branched from c65bf48a1c0158a74179affbfef26b6e11f5b2d1 on origin)

(yeah, i know, it’s probably time to update yay )

Reproduction Steps:
Run the above curl command against Phabricator. The error should pop up.


#2

My only suggestion is to try providing the dates as strings in yyyy-mm-dd format. I think that will work but I’m not entirely sure as I’ve never used conduit for editing calendar events.


#3

I have also ran into this error when trying to use the calendar.event.edit api. Similar to the OP, I have set epoch values for the start/end parameter (as per the documentation on Conduit). The string suggestion does not work because the api requires an integer for the start/end inputs.

Has anyone managed to get this API to work with start/end as part of the transactions parameter?

Thanks