Sanctions Search API: v2

<back to all web services

GetDbsSearches

DBS
The following routes are available for this service:
GET/dbsGet all DBS Searches
import Foundation
import ServiceStack

// @DataContract
public class GetDbsSearches : PagedRequest
{
    /**
    * Filter the results to those that have a Name including the specified value
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those that have a Name including the specified value", ParameterType="query")
    public var name:String

    /**
    * Filter the results to those that were created after (or on) this date
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those that were created after (or on) this date", ParameterType="query")
    public var dateFrom:Date?

    /**
    * Filter the results to those that were created before this date
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those that were created before this date", ParameterType="query")
    public var dateTo:Date?

    /**
    * Filter the results to those where the applicant has provided their information (true), or not (false), or either (null)
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those where the applicant has provided their information (true), or not (false), or either (null)", ParameterType="query")
    public var isApplicantInfoCompleted:Bool?

    /**
    * Filter the results to those where the ID Checker has verified the applicant's ID (true), or not (false), or either (null)
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those where the ID Checker has verified the applicant's ID (true), or not (false), or either (null)", ParameterType="query")
    public var isIdCheckCompleted:Bool?

    /**
    * Filter the results to those where the application is complete and ready to be submitted (true), or not (false), or either (null)
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those where the application is complete and ready to be submitted (true), or not (false), or either (null)", ParameterType="query")
    public var isApplicationCompleted:Bool?

    /**
    * Filter the results to those where the application has been submitted (true), or not (false), or either (null)
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those where the application has been submitted (true), or not (false), or either (null)", ParameterType="query")
    public var isApplicationSubmitted:Bool?

    /**
    * Filter the results to those where the application has been disclosed (true), or not (false), or either (null)
    */
    // @DataMember
    // @ApiMember(Description="Filter the results to those where the application has been disclosed (true), or not (false), or either (null)", ParameterType="query")
    public var isApplicationDisclosed:Bool?

    /**
    * If the searches are being accessed by a sub user, specify their username here to only return searches they have permissions to view
    */
    // @DataMember
    // @ApiMember(Description="If the searches are being accessed by a sub user, specify their username here to only return searches they have permissions to view", ParameterType="query")
    public var subUserName:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case name
        case dateFrom
        case dateTo
        case isApplicantInfoCompleted
        case isIdCheckCompleted
        case isApplicationCompleted
        case isApplicationSubmitted
        case isApplicationDisclosed
        case subUserName
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        dateFrom = try container.decodeIfPresent(Date.self, forKey: .dateFrom)
        dateTo = try container.decodeIfPresent(Date.self, forKey: .dateTo)
        isApplicantInfoCompleted = try container.decodeIfPresent(Bool.self, forKey: .isApplicantInfoCompleted)
        isIdCheckCompleted = try container.decodeIfPresent(Bool.self, forKey: .isIdCheckCompleted)
        isApplicationCompleted = try container.decodeIfPresent(Bool.self, forKey: .isApplicationCompleted)
        isApplicationSubmitted = try container.decodeIfPresent(Bool.self, forKey: .isApplicationSubmitted)
        isApplicationDisclosed = try container.decodeIfPresent(Bool.self, forKey: .isApplicationDisclosed)
        subUserName = try container.decodeIfPresent(String.self, forKey: .subUserName)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if name != nil { try container.encode(name, forKey: .name) }
        if dateFrom != nil { try container.encode(dateFrom, forKey: .dateFrom) }
        if dateTo != nil { try container.encode(dateTo, forKey: .dateTo) }
        if isApplicantInfoCompleted != nil { try container.encode(isApplicantInfoCompleted, forKey: .isApplicantInfoCompleted) }
        if isIdCheckCompleted != nil { try container.encode(isIdCheckCompleted, forKey: .isIdCheckCompleted) }
        if isApplicationCompleted != nil { try container.encode(isApplicationCompleted, forKey: .isApplicationCompleted) }
        if isApplicationSubmitted != nil { try container.encode(isApplicationSubmitted, forKey: .isApplicationSubmitted) }
        if isApplicationDisclosed != nil { try container.encode(isApplicationDisclosed, forKey: .isApplicationDisclosed) }
        if subUserName != nil { try container.encode(subUserName, forKey: .subUserName) }
    }
}

// @DataContract
public class PagedRequest : BaseRequest
{
    /**
    * The maximum number of records to be returned in one page
    */
    // @DataMember(Name="page[limit]")
    // @ApiMember(Description="The maximum number of records to be returned in one page", ParameterType="query")
    public var page_limit_:Int

    /**
    * The starting point in the list of records from where the data should be fetched. Zero based index.
    */
    // @DataMember(Name="page[offset]")
    // @ApiMember(Description="The starting point in the list of records from where the data should be fetched. Zero based index.", ParameterType="query")
    public var page_offset_:Int

    /**
    * The term to determine the order in which the data is returned
    */
    // @DataMember
    // @ApiMember(Description="The term to determine the order in which the data is returned", ParameterType="query")
    public var sort:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case page_limit_
        case page_offset_
        case sort
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        page_limit_ = try container.decodeIfPresent(Int.self, forKey: .page_limit_)
        page_offset_ = try container.decodeIfPresent(Int.self, forKey: .page_offset_)
        sort = try container.decodeIfPresent(String.self, forKey: .sort)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if page_limit_ != nil { try container.encode(page_limit_, forKey: .page_limit_) }
        if page_offset_ != nil { try container.encode(page_offset_, forKey: .page_offset_) }
        if sort != nil { try container.encode(sort, forKey: .sort) }
    }
}

// @DataContract
public class BaseRequest : IBaseRequest, Codable
{
    /**
    * The authentication credentials
    */
    // @DataMember
    // @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
    public var authentication:Authentication

    required public init(){}
}

// @DataContract
public class Authentication : Codable
{
    /**
    * 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")
    public var apiUserId:String

    /**
    * 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")
    public var apiUserKey:String

    required public init(){}
}

// @DataContract
public class GetDbsSearchesResponse : Codable
{
    // @DataMember
    public var data:GetDbsSearchesData

    required public init(){}
}

public class GetDbsSearchesData : PagedResponse<GetDbsSearches>
{
    public var searches:ArrayOfDbsSearchShort

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case searches
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        searches = try container.decodeIfPresent(ArrayOfDbsSearchShort.self, forKey: .searches)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if searches != nil { try container.encode(searches, forKey: .searches) }
    }
}

public class PagedResponse<T : Codable> : BaseResponse
{
    /**
    * The response Metadata
    */
    // @ApiMember(Description="The response Metadata")
    public var meta:Meta<T>

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case meta
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        meta = try container.decodeIfPresent(Meta<T>.self, forKey: .meta)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if meta != nil { try container.encode(meta, forKey: .meta) }
    }
}

public class BaseResponse : IBaseDataResponse, IHasResponseStatus, Codable
{
    /**
    * The status of the response
    */
    // @ApiMember(Description="The status of the response")
    public var responseStatus:ResponseStatus

    required public init(){}
}

public class ArrayOfResponseError : List<ResponseError>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class Meta<T : Codable> : Codable
{
    /**
    * Pagination links
    */
    // @ApiMember(Description="Pagination links")
    public var links:MetaLinks

    /**
    * The total number of records for the query
    */
    // @ApiMember(Description="The total number of records for the query")
    public var totalCount:Int?

    /**
    * The maximum number of records to be returned in one page
    */
    // @ApiMember(Description="The maximum number of records to be returned in one page")
    public var pageLimit:Int?

    /**
    * The starting point in the list of records from where the data should be fetched. Zero based index.
    */
    // @ApiMember(Description="The starting point in the list of records from where the data should be fetched. Zero based index.")
    public var pageOffset:Int?

    required public init(){}
}

public class MetaLinks : Links
{
    /**
    * The link to the first page of records
    */
    // @ApiMember(Description="The link to the first page of records")
    public var first:String

    /**
    * The link to the last page of records
    */
    // @ApiMember(Description="The link to the last page of records")
    public var last:String

    /**
    * The link to the next page of records, if applicable
    */
    // @ApiMember(Description="The link to the next page of records, if applicable")
    public var next:String

    /**
    * The link to the last page of records, if applicable
    */
    // @ApiMember(Description="The link to the last page of records, if applicable")
    public var prev:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case first
        case last
        case next
        case prev
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        first = try container.decodeIfPresent(String.self, forKey: .first)
        last = try container.decodeIfPresent(String.self, forKey: .last)
        next = try container.decodeIfPresent(String.self, forKey: .next)
        prev = try container.decodeIfPresent(String.self, forKey: .prev)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if first != nil { try container.encode(first, forKey: .first) }
        if last != nil { try container.encode(last, forKey: .last) }
        if next != nil { try container.encode(next, forKey: .next) }
        if prev != nil { try container.encode(prev, forKey: .prev) }
    }
}

public class Links : Codable
{
    // @ApiMember()
    public var `self`:String

    required public init(){}
}

public class ArrayOfDbsSearchShort : List<DbsSearchShort>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class DbsSearchShort : Codable
{
    public var id:Int
    public var dateSearched:Date
    public var dateUpdated:Date
    public var status:String
    public var disclosureStatus:String
    public var isApplicantInfoCompleted:Bool
    public var isIdCheckCompleted:Bool
    public var isApplicationCompleted:Bool
    public var isApplicationSubmitted:Bool
    public var isApplicationDisclosed:Bool
    public var disclosureLevel:String
    public var name:String
    public var reference:String

    required public init(){}
}


Swift GetDbsSearches DTOs

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

HTTP + XML

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

GET /dbs HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetDbsSearchesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Data>
    <ResponseStatus>
      <ErrorCode>String</ErrorCode>
      <Message>String</Message>
      <StackTrace>String</StackTrace>
      <Errors>
        <ResponseError>
          <ErrorCode>String</ErrorCode>
          <FieldName>String</FieldName>
          <Message>String</Message>
          <Meta xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:KeyValueOfstringstring>
              <d6p1:Key>String</d6p1:Key>
              <d6p1:Value>String</d6p1:Value>
            </d6p1:KeyValueOfstringstring>
          </Meta>
        </ResponseError>
      </Errors>
      <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>
    </ResponseStatus>
    <Meta>
      <Links>
        <Self>String</Self>
        <First>String</First>
        <Last>String</Last>
        <Next>String</Next>
        <Prev>String</Prev>
      </Links>
      <PageLimit>0</PageLimit>
      <PageOffset>0</PageOffset>
      <TotalCount>0</TotalCount>
    </Meta>
    <Searches>
      <SearchRecord>
        <DateSearched>0001-01-01T00:00:00</DateSearched>
        <DateUpdated>0001-01-01T00:00:00</DateUpdated>
        <DisclosureLevel>String</DisclosureLevel>
        <DisclosureStatus>String</DisclosureStatus>
        <Id>0</Id>
        <IsApplicantInfoCompleted>false</IsApplicantInfoCompleted>
        <IsApplicationCompleted>false</IsApplicationCompleted>
        <IsApplicationDisclosed>false</IsApplicationDisclosed>
        <IsApplicationSubmitted>false</IsApplicationSubmitted>
        <IsIdCheckCompleted>false</IsIdCheckCompleted>
        <Name>String</Name>
        <Reference>String</Reference>
        <Status>String</Status>
      </SearchRecord>
    </Searches>
  </Data>
</GetDbsSearchesResponse>