Required role: | REGISUserRole |
POST | /DynamicsCRM/Activity/Create/Multiple |
---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class CRMActivityCreateRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $regent_id=0,
/** @var string|null */
public ?string $lead_guid=null,
/** @var int|null */
public ?int $import_id=null,
/** @var string|null */
public ?string $subject=null,
/** @var string|null */
public ?string $description=null,
/** @var string|null */
public ?string $phone_email=null,
/** @var array<string>|null */
public ?array $email_cc=null,
/** @var string|null */
public ?string $gmail_thread_index=null,
/** @var string|null */
public ?string $related_username=null,
/** @var DateTime|null */
public ?DateTime $scheduled_start=null,
/** @var DateTime|null */
public ?DateTime $scheduled_end=null,
/** @var string|null */
public ?string $event_location=null,
/** @var string|null */
public ?string $event_type=null,
/** @var string|null */
public ?string $event_participation=null,
/** @var bool|null */
public ?bool $is_completed=null,
/** @var bool|null */
public ?bool $is_contact=null,
/** @var bool|null */
public ?bool $is_lead=null,
/** @var bool|null */
public ?bool $is_account=null,
/** @var bool|null */
public ?bool $is_email=null,
/** @var bool|null */
public ?bool $is_letter=null,
/** @var bool|null */
public ?bool $is_phonecall=null,
/** @var bool|null */
public ?bool $is_task=null,
/** @var bool|null */
public ?bool $is_meeting=null,
/** @var bool|null */
public ?bool $is_event=null,
/** @var DateTime|null */
public ?DateTime $date_of_occurrence=null,
/** @var DateTime|null */
public ?DateTime $added_date=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['regent_id'])) $this->regent_id = $o['regent_id'];
if (isset($o['lead_guid'])) $this->lead_guid = $o['lead_guid'];
if (isset($o['import_id'])) $this->import_id = $o['import_id'];
if (isset($o['subject'])) $this->subject = $o['subject'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['phone_email'])) $this->phone_email = $o['phone_email'];
if (isset($o['email_cc'])) $this->email_cc = JsonConverters::fromArray('string', $o['email_cc']);
if (isset($o['gmail_thread_index'])) $this->gmail_thread_index = $o['gmail_thread_index'];
if (isset($o['related_username'])) $this->related_username = $o['related_username'];
if (isset($o['scheduled_start'])) $this->scheduled_start = JsonConverters::from('DateTime', $o['scheduled_start']);
if (isset($o['scheduled_end'])) $this->scheduled_end = JsonConverters::from('DateTime', $o['scheduled_end']);
if (isset($o['event_location'])) $this->event_location = $o['event_location'];
if (isset($o['event_type'])) $this->event_type = $o['event_type'];
if (isset($o['event_participation'])) $this->event_participation = $o['event_participation'];
if (isset($o['is_completed'])) $this->is_completed = $o['is_completed'];
if (isset($o['is_contact'])) $this->is_contact = $o['is_contact'];
if (isset($o['is_lead'])) $this->is_lead = $o['is_lead'];
if (isset($o['is_account'])) $this->is_account = $o['is_account'];
if (isset($o['is_email'])) $this->is_email = $o['is_email'];
if (isset($o['is_letter'])) $this->is_letter = $o['is_letter'];
if (isset($o['is_phonecall'])) $this->is_phonecall = $o['is_phonecall'];
if (isset($o['is_task'])) $this->is_task = $o['is_task'];
if (isset($o['is_meeting'])) $this->is_meeting = $o['is_meeting'];
if (isset($o['is_event'])) $this->is_event = $o['is_event'];
if (isset($o['date_of_occurrence'])) $this->date_of_occurrence = JsonConverters::from('DateTime', $o['date_of_occurrence']);
if (isset($o['added_date'])) $this->added_date = JsonConverters::from('DateTime', $o['added_date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->regent_id)) $o['regent_id'] = $this->regent_id;
if (isset($this->lead_guid)) $o['lead_guid'] = $this->lead_guid;
if (isset($this->import_id)) $o['import_id'] = $this->import_id;
if (isset($this->subject)) $o['subject'] = $this->subject;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->phone_email)) $o['phone_email'] = $this->phone_email;
if (isset($this->email_cc)) $o['email_cc'] = JsonConverters::toArray('string', $this->email_cc);
if (isset($this->gmail_thread_index)) $o['gmail_thread_index'] = $this->gmail_thread_index;
if (isset($this->related_username)) $o['related_username'] = $this->related_username;
if (isset($this->scheduled_start)) $o['scheduled_start'] = JsonConverters::to('DateTime', $this->scheduled_start);
if (isset($this->scheduled_end)) $o['scheduled_end'] = JsonConverters::to('DateTime', $this->scheduled_end);
if (isset($this->event_location)) $o['event_location'] = $this->event_location;
if (isset($this->event_type)) $o['event_type'] = $this->event_type;
if (isset($this->event_participation)) $o['event_participation'] = $this->event_participation;
if (isset($this->is_completed)) $o['is_completed'] = $this->is_completed;
if (isset($this->is_contact)) $o['is_contact'] = $this->is_contact;
if (isset($this->is_lead)) $o['is_lead'] = $this->is_lead;
if (isset($this->is_account)) $o['is_account'] = $this->is_account;
if (isset($this->is_email)) $o['is_email'] = $this->is_email;
if (isset($this->is_letter)) $o['is_letter'] = $this->is_letter;
if (isset($this->is_phonecall)) $o['is_phonecall'] = $this->is_phonecall;
if (isset($this->is_task)) $o['is_task'] = $this->is_task;
if (isset($this->is_meeting)) $o['is_meeting'] = $this->is_meeting;
if (isset($this->is_event)) $o['is_event'] = $this->is_event;
if (isset($this->date_of_occurrence)) $o['date_of_occurrence'] = JsonConverters::to('DateTime', $this->date_of_occurrence);
if (isset($this->added_date)) $o['added_date'] = JsonConverters::to('DateTime', $this->added_date);
return empty($o) ? new class(){} : $o;
}
}
class CRMActivityCreateMultipleRequest implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $is_contact=null,
/** @var bool|null */
public ?bool $is_account=null,
/** @var bool|null */
public ?bool $is_event=null,
/** @var bool|null */
public ?bool $is_email=null,
/** @var bool|null */
public ?bool $is_meeting=null,
/** @var bool|null */
public ?bool $is_phonecall=null,
/** @var bool|null */
public ?bool $is_letter=null,
/** @var bool|null */
public ?bool $is_task=null,
/** @var string|null */
public ?string $related_username=null,
/** @var array<CRMActivityCreateRequest>|null */
public ?array $activities=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['is_contact'])) $this->is_contact = $o['is_contact'];
if (isset($o['is_account'])) $this->is_account = $o['is_account'];
if (isset($o['is_event'])) $this->is_event = $o['is_event'];
if (isset($o['is_email'])) $this->is_email = $o['is_email'];
if (isset($o['is_meeting'])) $this->is_meeting = $o['is_meeting'];
if (isset($o['is_phonecall'])) $this->is_phonecall = $o['is_phonecall'];
if (isset($o['is_letter'])) $this->is_letter = $o['is_letter'];
if (isset($o['is_task'])) $this->is_task = $o['is_task'];
if (isset($o['related_username'])) $this->related_username = $o['related_username'];
if (isset($o['activities'])) $this->activities = JsonConverters::fromArray('CRMActivityCreateRequest', $o['activities']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->is_contact)) $o['is_contact'] = $this->is_contact;
if (isset($this->is_account)) $o['is_account'] = $this->is_account;
if (isset($this->is_event)) $o['is_event'] = $this->is_event;
if (isset($this->is_email)) $o['is_email'] = $this->is_email;
if (isset($this->is_meeting)) $o['is_meeting'] = $this->is_meeting;
if (isset($this->is_phonecall)) $o['is_phonecall'] = $this->is_phonecall;
if (isset($this->is_letter)) $o['is_letter'] = $this->is_letter;
if (isset($this->is_task)) $o['is_task'] = $this->is_task;
if (isset($this->related_username)) $o['related_username'] = $this->related_username;
if (isset($this->activities)) $o['activities'] = JsonConverters::toArray('CRMActivityCreateRequest', $this->activities);
return empty($o) ? new class(){} : $o;
}
}
PHP CRMActivityCreateMultipleRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /DynamicsCRM/Activity/Create/Multiple HTTP/1.1
Host: data.regent-college.edu
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CRMActivityCreateMultipleRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.DynamicsCRM.Requests">
<activities>
<CRMActivityCreateRequest>
<added_date>0001-01-01T00:00:00</added_date>
<date_of_occurrence>0001-01-01T00:00:00</date_of_occurrence>
<description>String</description>
<email_cc xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>String</d4p1:string>
</email_cc>
<event_location>String</event_location>
<event_participation>String</event_participation>
<event_type>String</event_type>
<gmail_thread_index>String</gmail_thread_index>
<import_id>0</import_id>
<is_account>false</is_account>
<is_completed>false</is_completed>
<is_contact>false</is_contact>
<is_email>false</is_email>
<is_event>false</is_event>
<is_lead>false</is_lead>
<is_letter>false</is_letter>
<is_meeting>false</is_meeting>
<is_phonecall>false</is_phonecall>
<is_task>false</is_task>
<lead_guid>String</lead_guid>
<phone_email>String</phone_email>
<regent_id>0</regent_id>
<related_username>String</related_username>
<scheduled_end>0001-01-01T00:00:00</scheduled_end>
<scheduled_start>0001-01-01T00:00:00</scheduled_start>
<subject>String</subject>
</CRMActivityCreateRequest>
</activities>
<is_account>false</is_account>
<is_contact>false</is_contact>
<is_email>false</is_email>
<is_event>false</is_event>
<is_letter>false</is_letter>
<is_meeting>false</is_meeting>
<is_phonecall>false</is_phonecall>
<is_task>false</is_task>
<related_username>String</related_username>
</CRMActivityCreateMultipleRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:KeyValueOfstringstring> <d4p1:Key>String</d4p1:Key> <d4p1:Value>String</d4p1:Value> </d4p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:KeyValueOfstringstring> <d2p1:Key>String</d2p1:Key> <d2p1:Value>String</d2p1:Value> </d2p1:KeyValueOfstringstring> </Meta> </ResponseStatus>