We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Creating an Appointment using the REST API

HI

When I'm creating an appointment using the Rest API The created by the user is set to my users and not the one in the API call

I'm only using the associated in the call, it works fine on the associate, it picks up the right user and sets it on the appointment.

 

What is it I'm doing wrong?

 

 

RE: Creating an Appointment using the REST API

Are you setting the actual contact (customer) on the appointment?

NSAppointmentAgent agent;
NSAppointmentEntity entity = agent.CreateDefaultAppointmentEntityByType(1);
entity.SetContact(XX);
entity = agent.SaveAppointmentEntity(entity);

where XX is the ID of the contact you want to create the appointment towards.

Von: Patrik Larsson 10. Jul 2020

RE: Creating an Appointment using the REST API

Hi 

Yes I'm setting the customer as well.

I'm setting the Customer by id,
the associate by id,
the createdby by id,
the task type by the tasktypeid,
the contactperson by id,
the description
and start date and end date.

I'm using the REST API call post /api/v1/Appointment

Von: Rasmus Gamskjær Andersen 10. Jul 2020

RE: Creating an Appointment using the REST API

If I'm not mistaken, the CreatedBy value is ignored on the first save, and automatically assigned to the authenticated user.

This rings a bell.. I believe that if you accept the results from the first POST request, then update the CreatedBy associate ID and submit that in a PUT request I believe the new CreatedBy will be saved as expected.

Give that a try. If it works, I would suggest using a PATCH in future development instead of a PUT for a single property update. 

Best regards.

 

 

Von: Tony Yates 10. Jul 2020