| Required permission: | ReadInstitutions |
| POST | /institutions |
|---|
<?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 InstitutionResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null,
/** @var int */
public int $institution_id=0,
/** @var string|null */
public ?string $institution_name=null,
/** @var string|null */
public ?string $institution_previous_names=null,
/** @var string|null */
public ?string $institution_other_names=null,
/** @var string|null */
public ?string $institution_type=null,
/** @var string|null */
public ?string $accreditation_status=null,
/** @var string|null */
public ?string $accreditation_status_notes=null,
/** @var array<string>|null */
public ?array $related_institutions=null,
/** @var DateTime|null */
public ?DateTime $accreditation_status_changed_date=null,
/** @var string|null */
public ?string $gpa_conversion=null,
/** @var string|null */
public ?string $credit_hour_conversion=null,
/** @var string|null */
public ?string $addr1=null,
/** @var string|null */
public ?string $addr2=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $state=null,
/** @var string|null */
public ?string $country=null,
/** @var string|null */
public ?string $zip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['institution_id'])) $this->institution_id = $o['institution_id'];
if (isset($o['institution_name'])) $this->institution_name = $o['institution_name'];
if (isset($o['institution_previous_names'])) $this->institution_previous_names = $o['institution_previous_names'];
if (isset($o['institution_other_names'])) $this->institution_other_names = $o['institution_other_names'];
if (isset($o['institution_type'])) $this->institution_type = $o['institution_type'];
if (isset($o['accreditation_status'])) $this->accreditation_status = $o['accreditation_status'];
if (isset($o['accreditation_status_notes'])) $this->accreditation_status_notes = $o['accreditation_status_notes'];
if (isset($o['related_institutions'])) $this->related_institutions = JsonConverters::fromArray('string', $o['related_institutions']);
if (isset($o['accreditation_status_changed_date'])) $this->accreditation_status_changed_date = JsonConverters::from('DateTime', $o['accreditation_status_changed_date']);
if (isset($o['gpa_conversion'])) $this->gpa_conversion = $o['gpa_conversion'];
if (isset($o['credit_hour_conversion'])) $this->credit_hour_conversion = $o['credit_hour_conversion'];
if (isset($o['addr1'])) $this->addr1 = $o['addr1'];
if (isset($o['addr2'])) $this->addr2 = $o['addr2'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['state'])) $this->state = $o['state'];
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['zip'])) $this->zip = $o['zip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->institution_id)) $o['institution_id'] = $this->institution_id;
if (isset($this->institution_name)) $o['institution_name'] = $this->institution_name;
if (isset($this->institution_previous_names)) $o['institution_previous_names'] = $this->institution_previous_names;
if (isset($this->institution_other_names)) $o['institution_other_names'] = $this->institution_other_names;
if (isset($this->institution_type)) $o['institution_type'] = $this->institution_type;
if (isset($this->accreditation_status)) $o['accreditation_status'] = $this->accreditation_status;
if (isset($this->accreditation_status_notes)) $o['accreditation_status_notes'] = $this->accreditation_status_notes;
if (isset($this->related_institutions)) $o['related_institutions'] = JsonConverters::toArray('string', $this->related_institutions);
if (isset($this->accreditation_status_changed_date)) $o['accreditation_status_changed_date'] = JsonConverters::to('DateTime', $this->accreditation_status_changed_date);
if (isset($this->gpa_conversion)) $o['gpa_conversion'] = $this->gpa_conversion;
if (isset($this->credit_hour_conversion)) $o['credit_hour_conversion'] = $this->credit_hour_conversion;
if (isset($this->addr1)) $o['addr1'] = $this->addr1;
if (isset($this->addr2)) $o['addr2'] = $this->addr2;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->state)) $o['state'] = $this->state;
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->zip)) $o['zip'] = $this->zip;
return empty($o) ? new class(){} : $o;
}
}
class InstitutionRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $institution_id=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['institution_id'])) $this->institution_id = $o['institution_id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->institution_id)) $o['institution_id'] = $this->institution_id;
return empty($o) ? new class(){} : $o;
}
}
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 /institutions HTTP/1.1
Host: data.regent-college.edu
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<InstitutionRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.ClassLibrary.Requests">
<institution_id>0</institution_id>
</InstitutionRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<InstitutionResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.ClassLibrary.Responses">
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<accreditation_status>String</accreditation_status>
<accreditation_status_changed_date>0001-01-01T00:00:00</accreditation_status_changed_date>
<accreditation_status_notes>String</accreditation_status_notes>
<addr1>String</addr1>
<addr2>String</addr2>
<city>String</city>
<country>String</country>
<credit_hour_conversion>String</credit_hour_conversion>
<gpa_conversion>String</gpa_conversion>
<institution_id>0</institution_id>
<institution_name>String</institution_name>
<institution_other_names>String</institution_other_names>
<institution_previous_names>String</institution_previous_names>
<institution_type>String</institution_type>
<related_institutions xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</related_institutions>
<state>String</state>
<zip>String</zip>
</InstitutionResponse>