ScannerVision Web Server

<back to all web services

PostQuestion

Requires Authentication
The following routes are available for this service:
POST/{Brand}/question/{TemplateGuid}/{QuestionGuid}
import Foundation
import ServiceStack

public class PostQuestion : QuestionRequestDto
{
    public var questionValueReturned:String
    public var questionValueDisplayed:String
    public var selectedFolder:String

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

    private enum CodingKeys : String, CodingKey {
        case questionValueReturned
        case questionValueDisplayed
        case selectedFolder
    }

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

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

public class QuestionRequestDto : RequestBase
{
    public var templateGuid:String
    public var questionGuid:String
    public var parent:String
    public var folderBrowser:String

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

    private enum CodingKeys : String, CodingKey {
        case templateGuid
        case questionGuid
        case parent
        case folderBrowser
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        templateGuid = try container.decodeIfPresent(String.self, forKey: .templateGuid)
        questionGuid = try container.decodeIfPresent(String.self, forKey: .questionGuid)
        parent = try container.decodeIfPresent(String.self, forKey: .parent)
        folderBrowser = try container.decodeIfPresent(String.self, forKey: .folderBrowser)
    }

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

public class RequestBase : DtoBase
{
    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 DtoBase : Codable
{
    public var brand:Brand

    required public init(){}
}

public enum Brand : String, Codable
{
    case Desktop
    case Hp
    case Kyocera
    case NeaScan
    case Samsung
    case FujiXerox
    case Ta
    case Utax
    case Epson
    case ScanFront400
    case Sharp
    case Ricoh
    case FujiFilm
}


Swift PostQuestion 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.

POST /{Brand}/question/{TemplateGuid}/{QuestionGuid} HTTP/1.1 
Host: buildmax.org 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PostQuestion xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ScannerVision.WebService.ServiceModel">
  <Brand>Desktop</Brand>
  <FolderBrowser>String</FolderBrowser>
  <Parent>String</Parent>
  <QuestionGuid>String</QuestionGuid>
  <TemplateGuid>String</TemplateGuid>
  <QuestionValueDisplayed>String</QuestionValueDisplayed>
  <QuestionValueReturned>String</QuestionValueReturned>
  <SelectedFolder>String</SelectedFolder>
</PostQuestion>