Post

3 followers Follow
0
Avatar

Clarizen API v2 Add holiday event on specific user calendar over API

Hi everyone, I have a question how I would add new holiday allocated to calendar of employee.

Let say username: company.application password:somepassword.

Employee username are: John.Bean

 

API steps are following, I will ignore server source and authentication as this part is done already and implementation of it was buttery smooth.

So we need list of employees with their id:

Endpoint:

https://apie1.clarizen.com/v2.0/services/data/entityQuery

Method: POST

Body:

{

            "typeName":"User",

            "fields":"firstName, lastName"

}

Payload:

{

 "entities": [

{

  "id": "/User/5ltkb52s0xak4rdbdcsmye3rh5203",

     "firstName": "John",

     "lastName": "Bean"

},

….

 ]

}

That way we know userId of employees, we need to use that later as Holiday Event need to be added to John Bean Calendar

 

Now we need add new event to CalendarException:

Endpoint:

https://apie1.clarizen.com/v2.0/services/data/objects/CalendarException

Method:PUT

Body:

{

 "name":"Holiday - John Bean"

 "startDate": "2017-07-10T12:00:00.0000000",

 "endDate”: "2017-07-20T12:00:00.0000000",

 "ExceptionType":"/ExceptionType/Holiday"

-> what should be added there to allocated this event to John Bean Calendar?

}

Payload:

{

"id": "/CalendarException/4xrrk4ynl327cyg663o9gyb2n814"

}

New event added.

So now we list all events in Clarizen:

Endpoint:

https://apie1.clarizen.com/v2.0/services/data/query

Method: POST

Body:

{

"q":"SELECT @Name, StartDate, EndDate, ExceptionType, CreatedOn, EntityType, CreatedBy FROM CalendarException WHERE StartDate>2015-01-01 ORDER BY StartDate DESC"

}

What should be in Select to shown relation to employee?

 

Payload:

{
"entities": [
{
"id": "/CalendarException/4xrrk4ynl327cyg663o9gyb2n814",
"Name": "Holiday - John Bean",
"StartDate": "2017-07-10T00:00:00.0000000",
"EndDate": "2017-07-20T00:00:00.0000000",
"ExceptionType": {
"id": "/ExceptionType/Holiday"
},
"CreatedOn": "2017-05-26T10:39:48.0253370",
"EntityType": "Calendar Exception",
"CreatedBy": {
"id": "/User/6gulqivn183dyyn7ar0luyjza36485"
}
},

...

  ],
"paging": {
"from": 3,
"limit": 100,
"hasMore": false
}
}

 

Looking forward for solution.

Regards

Stefan O.

 

 

Stefan Oliwa Answered

Official comment

Avatar

Hi Stefan,

Currently we do not support adding calendar exception for users using the API. You can try to use our customize workflows to accomplish what you want.

Hope this helps,

Elad

Elad Franklin
Comment actions Permalink

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Elad,

Thank you for replied,

Would you point me to "customize workflow "in documentation. It's too much fragmentation out there and inconsistency. Do you think we should create "customize workflow" and then trigger that "customize workflow" over API?

It's possible then pass variable to customize workflow like start date, end date, title and then allocate to specific user?

I'm impressed, as  basic functionality for any management software are not implemented on API  level, please consider to implement that in future release.

Regards

Stefan Oliwa

Stefan Oliwa 0 votes
Comment actions Permalink
0
Avatar

Hi Stefan,

As an example, you can do the following:

As administrator, go to "Settings -> Configure". Select "User" type and create a new Custom Action, named "Create User Calendar Exception".

You can start from this example.

In this case, "CurrentObject()" means the selected User, 'Personal' is from the Exception Type PickList. You'll have to deal with TimeZone (convert date from or to 'UTC' TimeZone). For instance, in my example, the exception created was 1 day before expected.

 

From that, you can improve by adding input values to the custom action. That would be only relevant if you plan to add the same exception on multiple user.

You also have the possibility to set a calendar exception on a project, maybe that could do what you want.

Hope this helps.

Regards,

Armand

Armand BOLMONT 0 votes
Comment actions Permalink