Sanctions Search API: v2

<back to all web services

AddDbsSearch

DBS
The following routes are available for this service:
POST/dbsAdd a DBS Search
<?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};


// @DataContract
class Authentication implements JsonSerializable
{
    public function __construct(
        /** @description The API User ID provided by us when you signed up to use our API */
        // @DataMember
        // @ApiMember(Description="The API User ID provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
        /** @var string */
        public string $apiUserId='',

        /** @description The API User Key provided by us when you signed up to use our API */
        // @DataMember
        // @ApiMember(Description="The API User Key provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
        /** @var string */
        public string $apiUserKey=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['apiUserId'])) $this->apiUserId = $o['apiUserId'];
        if (isset($o['apiUserKey'])) $this->apiUserKey = $o['apiUserKey'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->apiUserId)) $o['apiUserId'] = $this->apiUserId;
        if (isset($this->apiUserKey)) $o['apiUserKey'] = $this->apiUserKey;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class BaseRequest implements IBaseRequest, JsonSerializable
{
    public function __construct(
        /** @description The authentication credentials */
        // @DataMember
        // @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
        /** @var Authentication|null */
        public ?Authentication $authentication=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['authentication'])) $this->authentication = JsonConverters::from('Authentication', $o['authentication']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->authentication)) $o['authentication'] = JsonConverters::to('Authentication', $this->authentication);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class ResponseError implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var string|null */
        public ?string $errorCode=null,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $fieldName=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $message=null,

        // @DataMember(Order=4)
        /** @var array<string,string>|null */
        public ?array $meta=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
        if (isset($o['fieldName'])) $this->fieldName = $o['fieldName'];
        if (isset($o['message'])) $this->message = $o['message'];
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
        if (isset($this->fieldName)) $o['fieldName'] = $this->fieldName;
        if (isset($this->message)) $o['message'] = $this->message;
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of ResponseError
 */
class ArrayOfResponseError extends \ArrayObject implements JsonSerializable
{
    public function __construct(ResponseError ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof ResponseError)
            parent::append($value);
        else
            throw new \Exception("Can only append a ResponseError to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new ResponseError();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

// @DataContract
class ResponseStatus implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var string|null */
        public ?string $errorCode=null,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $message=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $stackTrace=null,

        // @DataMember(Order=4)
        /** @var ArrayOfResponseError|null */
        public ?ArrayOfResponseError $errors=null,

        // @DataMember(Order=5)
        /** @var array<string,string>|null */
        public ?array $meta=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
        if (isset($o['message'])) $this->message = $o['message'];
        if (isset($o['stackTrace'])) $this->stackTrace = $o['stackTrace'];
        if (isset($o['errors'])) $this->errors = JsonConverters::from('ArrayOfResponseError', $o['errors']);
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
        if (isset($this->message)) $o['message'] = $this->message;
        if (isset($this->stackTrace)) $o['stackTrace'] = $this->stackTrace;
        if (isset($this->errors)) $o['errors'] = JsonConverters::to('ArrayOfResponseError', $this->errors);
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        return empty($o) ? new class(){} : $o;
    }
}

class BaseResponse implements IBaseDataResponse, IHasResponseStatus, JsonSerializable
{
    public function __construct(
        /** @description The status of the response */
        // @ApiMember(Description="The status of the response")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class LinkedTo implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $clientId=null,
        /** @var int|null */
        public ?int $id=null,
        /** @var string|null */
        public ?string $type=null,
        /** @var string|null */
        public ?string $subtype=null,
        /** @var string|null */
        public ?string $status=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var bool|null */
        public ?bool $isArchived=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var DateTime|null */
        public ?DateTime $date=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['clientId'])) $this->clientId = $o['clientId'];
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['type'])) $this->type = $o['type'];
        if (isset($o['subtype'])) $this->subtype = $o['subtype'];
        if (isset($o['status'])) $this->status = $o['status'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['isArchived'])) $this->isArchived = $o['isArchived'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->clientId)) $o['clientId'] = $this->clientId;
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->type)) $o['type'] = $this->type;
        if (isset($this->subtype)) $o['subtype'] = $this->subtype;
        if (isset($this->status)) $o['status'] = $this->status;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->isArchived)) $o['isArchived'] = $this->isArchived;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of LinkedTo
 */
class ArrayOfLinkedTo extends \ArrayObject implements JsonSerializable
{
    public function __construct(LinkedTo ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof LinkedTo)
            parent::append($value);
        else
            throw new \Exception("Can only append a LinkedTo to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new LinkedTo();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

class ApplicantInformation implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $dateOfBirth=null,
        /** @var string|null */
        public ?string $email=null,
        /** @var string|null */
        public ?string $mobileInternational=null,
        /** @var string|null */
        public ?string $jobLocation=null,
        /** @var string|null */
        public ?string $reference=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['dateOfBirth'])) $this->dateOfBirth = $o['dateOfBirth'];
        if (isset($o['email'])) $this->email = $o['email'];
        if (isset($o['mobileInternational'])) $this->mobileInternational = $o['mobileInternational'];
        if (isset($o['jobLocation'])) $this->jobLocation = $o['jobLocation'];
        if (isset($o['reference'])) $this->reference = $o['reference'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->dateOfBirth)) $o['dateOfBirth'] = $this->dateOfBirth;
        if (isset($this->email)) $o['email'] = $this->email;
        if (isset($this->mobileInternational)) $o['mobileInternational'] = $this->mobileInternational;
        if (isset($this->jobLocation)) $o['jobLocation'] = $this->jobLocation;
        if (isset($this->reference)) $o['reference'] = $this->reference;
        return empty($o) ? new class(){} : $o;
    }
}

class DbsSearchSummary implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var DateTime */
        public DateTime $dateSearched=new DateTime(),
        /** @var DateTime */
        public DateTime $dateUpdated=new DateTime(),
        /** @var string|null */
        public ?string $status=null,
        /** @var string|null */
        public ?string $disclosureStatus=null,
        /** @var bool|null */
        public ?bool $isApplicantInfoCompleted=null,
        /** @var bool|null */
        public ?bool $isIdCheckCompleted=null,
        /** @var bool|null */
        public ?bool $isApplicationCompleted=null,
        /** @var bool|null */
        public ?bool $isApplicationSubmitted=null,
        /** @var bool|null */
        public ?bool $isApplicationDisclosed=null,
        /** @var string|null */
        public ?string $disclosureLevel=null,
        /** @var ApplicantInformation|null */
        public ?ApplicantInformation $applicantInformation=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['dateSearched'])) $this->dateSearched = JsonConverters::from('DateTime', $o['dateSearched']);
        if (isset($o['dateUpdated'])) $this->dateUpdated = JsonConverters::from('DateTime', $o['dateUpdated']);
        if (isset($o['status'])) $this->status = $o['status'];
        if (isset($o['disclosureStatus'])) $this->disclosureStatus = $o['disclosureStatus'];
        if (isset($o['isApplicantInfoCompleted'])) $this->isApplicantInfoCompleted = $o['isApplicantInfoCompleted'];
        if (isset($o['isIdCheckCompleted'])) $this->isIdCheckCompleted = $o['isIdCheckCompleted'];
        if (isset($o['isApplicationCompleted'])) $this->isApplicationCompleted = $o['isApplicationCompleted'];
        if (isset($o['isApplicationSubmitted'])) $this->isApplicationSubmitted = $o['isApplicationSubmitted'];
        if (isset($o['isApplicationDisclosed'])) $this->isApplicationDisclosed = $o['isApplicationDisclosed'];
        if (isset($o['disclosureLevel'])) $this->disclosureLevel = $o['disclosureLevel'];
        if (isset($o['applicantInformation'])) $this->applicantInformation = JsonConverters::from('ApplicantInformation', $o['applicantInformation']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->dateSearched)) $o['dateSearched'] = JsonConverters::to('DateTime', $this->dateSearched);
        if (isset($this->dateUpdated)) $o['dateUpdated'] = JsonConverters::to('DateTime', $this->dateUpdated);
        if (isset($this->status)) $o['status'] = $this->status;
        if (isset($this->disclosureStatus)) $o['disclosureStatus'] = $this->disclosureStatus;
        if (isset($this->isApplicantInfoCompleted)) $o['isApplicantInfoCompleted'] = $this->isApplicantInfoCompleted;
        if (isset($this->isIdCheckCompleted)) $o['isIdCheckCompleted'] = $this->isIdCheckCompleted;
        if (isset($this->isApplicationCompleted)) $o['isApplicationCompleted'] = $this->isApplicationCompleted;
        if (isset($this->isApplicationSubmitted)) $o['isApplicationSubmitted'] = $this->isApplicationSubmitted;
        if (isset($this->isApplicationDisclosed)) $o['isApplicationDisclosed'] = $this->isApplicationDisclosed;
        if (isset($this->disclosureLevel)) $o['disclosureLevel'] = $this->disclosureLevel;
        if (isset($this->applicantInformation)) $o['applicantInformation'] = JsonConverters::to('ApplicantInformation', $this->applicantInformation);
        return empty($o) ? new class(){} : $o;
    }
}

class AddDbsSearchData extends BaseResponse implements IBaseSearchResponse, JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        /** @var ArrayOfLinkedTo|null */
        public ?ArrayOfLinkedTo $linkedTo=null,
        /** @var DbsSearchSummary|null */
        public ?DbsSearchSummary $summary=null
    ) {
        parent::__construct($responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['linkedTo'])) $this->linkedTo = JsonConverters::from('ArrayOfLinkedTo', $o['linkedTo']);
        if (isset($o['summary'])) $this->summary = JsonConverters::from('DbsSearchSummary', $o['summary']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->linkedTo)) $o['linkedTo'] = JsonConverters::to('ArrayOfLinkedTo', $this->linkedTo);
        if (isset($this->summary)) $o['summary'] = JsonConverters::to('DbsSearchSummary', $this->summary);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AddDbsSearchResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var AddDbsSearchData|null */
        public ?AddDbsSearchData $data=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['data'])) $this->data = JsonConverters::from('AddDbsSearchData', $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->data)) $o['data'] = JsonConverters::to('AddDbsSearchData', $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

class AddDbsSearchRequest implements JsonSerializable
{
    public function __construct(
        /** @description The full name of the applicant */
        // @ApiMember(Description="The full name of the applicant", IsRequired=true)
        /** @var string */
        public string $name='',

        /** @description The date of birth for the applicant (DD/MM/YYYY format) */
        // @ApiMember(Description="The date of birth for the applicant (DD/MM/YYYY format)", IsRequired=true)
        /** @var string */
        public string $dateOfBirth='',

        /** @description The email address of the applicant */
        // @ApiMember(Description="The email address of the applicant", IsRequired=true)
        /** @var string */
        public string $email='',

        /** @description The applicant's mobile phone number in international format (e.g. '+447123456789') */
        // @ApiMember(Description="The applicant's mobile phone number in international format (e.g. '+447123456789')", IsRequired=true)
        /** @var string */
        public string $mobileInternational='',

        /** @description The country where the job is located */
        // @ApiMember(Description="The country where the job is located", IsRequired=true)
        /** @var string */
        public string $jobLocation='',

        /** @description The disclosure level of the DBS required */
        // @ApiMember(Description="The disclosure level of the DBS required", IsRequired=true)
        /** @var string */
        public string $disclosureLevel='',

        /** @description Your reference, if any */
        // @ApiMember(Description="Your reference, if any")
        /** @var string|null */
        public ?string $reference=null,

        /** @description If this is specified, the search will be created for the specified sub user, otherwise it will be created in the main user account */
        // @ApiMember(Description="If this is specified, the search will be created for the specified sub user, otherwise it will be created in the main user account")
        /** @var string|null */
        public ?string $subUserName=null,

        /** @description If the search should be linked to other searches, specify the them here */
        // @ApiMember(Description="If the search should be linked to other searches, specify the them here")
        /** @var ArrayOfLinkedTo|null */
        public ?ArrayOfLinkedTo $linkedTo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['dateOfBirth'])) $this->dateOfBirth = $o['dateOfBirth'];
        if (isset($o['email'])) $this->email = $o['email'];
        if (isset($o['mobileInternational'])) $this->mobileInternational = $o['mobileInternational'];
        if (isset($o['jobLocation'])) $this->jobLocation = $o['jobLocation'];
        if (isset($o['disclosureLevel'])) $this->disclosureLevel = $o['disclosureLevel'];
        if (isset($o['reference'])) $this->reference = $o['reference'];
        if (isset($o['subUserName'])) $this->subUserName = $o['subUserName'];
        if (isset($o['linkedTo'])) $this->linkedTo = JsonConverters::from('ArrayOfLinkedTo', $o['linkedTo']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->dateOfBirth)) $o['dateOfBirth'] = $this->dateOfBirth;
        if (isset($this->email)) $o['email'] = $this->email;
        if (isset($this->mobileInternational)) $o['mobileInternational'] = $this->mobileInternational;
        if (isset($this->jobLocation)) $o['jobLocation'] = $this->jobLocation;
        if (isset($this->disclosureLevel)) $o['disclosureLevel'] = $this->disclosureLevel;
        if (isset($this->reference)) $o['reference'] = $this->reference;
        if (isset($this->subUserName)) $o['subUserName'] = $this->subUserName;
        if (isset($this->linkedTo)) $o['linkedTo'] = JsonConverters::to('ArrayOfLinkedTo', $this->linkedTo);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AddDbsSearch extends BaseRequest implements JsonSerializable
{
    /**
     * @param Authentication|null $authentication
     */
    public function __construct(
        ?Authentication $authentication=null,
        // @DataMember
        /** @var AddDbsSearchRequest|null */
        public ?AddDbsSearchRequest $request=null
    ) {
        parent::__construct($authentication);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['request'])) $this->request = JsonConverters::from('AddDbsSearchRequest', $o['request']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->request)) $o['request'] = JsonConverters::to('AddDbsSearchRequest', $this->request);
        return empty($o) ? new class(){} : $o;
    }
}

PHP AddDbsSearch DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /dbs HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"request":{"name":"String","dateOfBirth":"String","email":"String","mobileInternational":"String","jobLocation":"String","disclosureLevel":"String","reference":"String","subUserName":"String","linkedTo":[{"clientId":0,"id":0,"type":"String","subtype":"String","status":"String","description":"String","isArchived":false,"name":"String","date":"\/Date(-62135596800000-0000)\/"}]},"authentication":{"apiUserId":"String","apiUserKey":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"data":{"linkedTo":[{"clientId":0,"id":0,"type":"String","subtype":"String","status":"String","description":"String","isArchived":false,"name":"String","date":"\/Date(-62135596800000-0000)\/"}],"summary":{"id":0,"dateSearched":"\/Date(-62135596800000-0000)\/","dateUpdated":"\/Date(-62135596800000-0000)\/","status":"String","disclosureStatus":"String","isApplicantInfoCompleted":false,"isIdCheckCompleted":false,"isApplicationCompleted":false,"isApplicationSubmitted":false,"isApplicationDisclosed":false,"disclosureLevel":"String","applicantInformation":{"name":"String","dateOfBirth":"String","email":"String","mobileInternational":"String","jobLocation":"String","reference":"String"}},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}}