LiquidPlanner Classic Forum
Creating an event via api does not set owner
over 5 years ago by LiquidPlanner Support(edited)
Posted on behalf of Wim Deblauwe. Original posting date 2014-09-19.
Hi,
The Groovy script I am using to sync appointments in Outlook with LiquidPlanner no longer works. It seems that the "owner" is no longer set. This is how I do it in Groovy:
String requestPath = 'workspaces/' + LP_WORKSPACE_ID + '/events/';
liquidPlanner.request( Method.POST, ContentType.JSON ) { req ->
uri.path = requestPath;
def startTime = LP_DATE_FORMATTER.print( startDateTime )
def endTime = LP_DATE_FORMATTER.print( endDateTime )
logger.debug "$startTime - $endTime : ${subject}"
body = [event: [
name: subject,
owner_id: userVacationPackage.ownerId,
parent_id: userVacationPackage.id,
external_reference: exchangeAppointmentId,
start_date: startTime,
finish_date: endTime]]
response.success = { resp, json ->
logger.debug "Succesfully created appointment in LP"
}
response.failure = { resp ->
throw new RuntimeException( "Unable to create appointment in LP: ${resp.status} - ${requestPath}" )
}
}
Notice how I set the "owner_id" in the request body. I always get a success response, but the event is always set as "unassigned". Any idea why this might be?
regards,
Wim
PS: I tried to use the "Postman" Chrome extension to try to reproduce it, but I don't know what options I need to set to make it work correctly. I always get this result:
{
"type": "Error",
"error": "InternalServerError",
"message": "Internal error; try again and perhaps it will work (no promises)."
}