POST | /dbs | Add a DBS Search |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Authentication:
# @ApiMember(Description="The API User ID provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
api_user_id: Optional[str] = None
"""
The API User ID provided by us when you signed up to use our API
"""
# @ApiMember(Description="The API User Key provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
api_user_key: Optional[str] = None
"""
The API User Key provided by us when you signed up to use our API
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseRequest(IBaseRequest):
# @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
authentication: Optional[Authentication] = None
"""
The authentication credentials
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ResponseError:
error_code: Optional[str] = None
field_name: Optional[str] = None
message: Optional[str] = None
meta: Optional[Dict[str, str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ArrayOfResponseError(List[ResponseError]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ResponseStatus:
error_code: Optional[str] = None
message: Optional[str] = None
stack_trace: Optional[str] = None
errors: Optional[ArrayOfResponseError] = None
meta: Optional[Dict[str, str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse(IBaseDataResponse, IHasResponseStatus):
# @ApiMember(Description="The status of the response")
response_status: Optional[ResponseStatus] = None
"""
The status of the response
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LinkedTo:
client_id: Optional[int] = None
id: Optional[int] = None
type: Optional[str] = None
subtype: Optional[str] = None
status: Optional[str] = None
description: Optional[str] = None
is_archived: Optional[bool] = None
name: Optional[str] = None
date: Optional[datetime.datetime] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ArrayOfLinkedTo(List[LinkedTo]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApplicantInformation:
name: Optional[str] = None
date_of_birth: Optional[str] = None
email: Optional[str] = None
mobile_international: Optional[str] = None
job_location: Optional[str] = None
reference: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DbsSearchSummary:
id: int = 0
date_searched: datetime.datetime = datetime.datetime(1, 1, 1)
date_updated: datetime.datetime = datetime.datetime(1, 1, 1)
status: Optional[str] = None
disclosure_status: Optional[str] = None
is_applicant_info_completed: bool = False
is_id_check_completed: bool = False
is_application_completed: bool = False
is_application_submitted: bool = False
is_application_disclosed: bool = False
disclosure_level: Optional[str] = None
applicant_information: Optional[ApplicantInformation] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddDbsSearchData(BaseResponse, IBaseSearchResponse):
linked_to: Optional[ArrayOfLinkedTo] = None
summary: Optional[DbsSearchSummary] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddDbsSearchResponse:
data: Optional[AddDbsSearchData] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddDbsSearchRequest:
# @ApiMember(Description="The full name of the applicant", IsRequired=true)
name: Optional[str] = None
"""
The full name of the applicant
"""
# @ApiMember(Description="The date of birth for the applicant (DD/MM/YYYY format)", IsRequired=true)
date_of_birth: Optional[str] = None
"""
The date of birth for the applicant (DD/MM/YYYY format)
"""
# @ApiMember(Description="The email address of the applicant", IsRequired=true)
email: Optional[str] = None
"""
The email address of the applicant
"""
# @ApiMember(Description="The applicant's mobile phone number in international format (e.g. '+447123456789')", IsRequired=true)
mobile_international: Optional[str] = None
"""
The applicant's mobile phone number in international format (e.g. '+447123456789')
"""
# @ApiMember(Description="The country where the job is located", IsRequired=true)
job_location: Optional[str] = None
"""
The country where the job is located
"""
# @ApiMember(Description="The disclosure level of the DBS required", IsRequired=true)
disclosure_level: Optional[str] = None
"""
The disclosure level of the DBS required
"""
# @ApiMember(Description="Your reference, if any")
reference: Optional[str] = None
"""
Your reference, if any
"""
# @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")
sub_user_name: Optional[str] = None
"""
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 the search should be linked to other searches, specify the them here")
linked_to: Optional[ArrayOfLinkedTo] = None
"""
If the search should be linked to other searches, specify the them here
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddDbsSearch(BaseRequest):
request: Optional[AddDbsSearchRequest] = None
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
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"}}}}