Sanctions Search API: v2

<back to all web services

GetBulkSearchHistory

Bulk Search
The following routes are available for this service:
POST/bulksearches/listGet all bulk searches
import Foundation
import ServiceStack

// @DataContract
public class GetBulkSearchHistory : BaseRequest
{
    // @DataMember
    public var request:GetBulkSearchHistoryRequest

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

    private enum CodingKeys : String, CodingKey {
        case request
    }

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

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

// @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(){}
}

public class GetBulkSearchHistoryRequest : Codable
{
    public var subUserName:String
    public var page:Int
    public var sortOrder:String
    /**
    * The user id to filter on, in string format (GUID)
    */
    // @ApiMember(Description="The user id to filter on, in string format (GUID)")
    public var whereUserId:String

    public var whereDateFrom:Date?
    public var whereDateTo:Date?
    public var whereId:Int?
    public var pageSize:Int

    required public init(){}
}

// @DataContract
public class GetBulkSearchHistoryResponse : Codable
{
    // @DataMember
    public var data:GetBulkSearchHistoryData

    required public init(){}
}

public class GetBulkSearchHistoryData : BaseResponse
{
    public var bulkSearchList:ArrayOfBulkSearchStatus
    public var currentPageNum:Int
    public var maxPageNum:Int
    public var totalBulkSearches:Int
    public var pageSize:Int

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

    private enum CodingKeys : String, CodingKey {
        case bulkSearchList
        case currentPageNum
        case maxPageNum
        case totalBulkSearches
        case pageSize
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        bulkSearchList = try container.decodeIfPresent(ArrayOfBulkSearchStatus.self, forKey: .bulkSearchList)
        currentPageNum = try container.decodeIfPresent(Int.self, forKey: .currentPageNum)
        maxPageNum = try container.decodeIfPresent(Int.self, forKey: .maxPageNum)
        totalBulkSearches = try container.decodeIfPresent(Int.self, forKey: .totalBulkSearches)
        pageSize = try container.decodeIfPresent(Int.self, forKey: .pageSize)
    }

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

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 ArrayOfBulkSearchStatus : List<BulkSearchStatus>
{
    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 BulkSearchStatus : Codable
{
    public var bulkSearchId:Int
    public var success:Bool
    public var status:String
    public var total:Int
    public var message:String
    public var processed:Int
    public var isPepSearch:Bool
    public var isSanctionsSearch:Bool
    public var totalPep:Int
    public var processedPep:Int
    public var totalSanctions:Int
    public var processedSanctions:Int

    required public init(){}
}


Swift GetBulkSearchHistory 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 /bulksearches/list HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"request":{"subUserName":"String","page":0,"sortOrder":"String","whereUserId":"String","whereDateFrom":"\/Date(-62135596800000-0000)\/","whereDateTo":"\/Date(-62135596800000-0000)\/","whereId":0,"pageSize":0},"authentication":{"apiUserId":"String","apiUserKey":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"data":{"bulkSearchList":[{"bulkSearchId":0,"success":false,"status":"String","total":0,"message":"String","processed":0,"isPepSearch":false,"isSanctionsSearch":false,"totalPep":0,"processedPep":0,"totalSanctions":0,"processedSanctions":0}],"currentPageNum":0,"maxPageNum":0,"totalBulkSearches":0,"pageSize":0,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}}