| PUT | /v4/user-affiliate-tokens/{guid} | Add group affiliate override info for a specific program | List of supported affiliate programs may be retrieved by calling the GET /v3/affiliate-programs endpoint. Parameter names must match and valid values must be provided. |
|---|
import Foundation
import ServiceStack
// @DataContract
public class PutUserAffiliateTokensRequest : AffiliateTokensRequestBase
{
// @DataMember(Name="guid", IsRequired=true)
public var guid:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case guid
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
guid = try container.decodeIfPresent(String.self, forKey: .guid)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if guid != nil { try container.encode(guid, forKey: .guid) }
}
}
public class AffiliateTokensRequestBase : Codable
{
// @DataMember(Name="username", IsRequired=true)
public var username:String
// @DataMember(Name="parameters", IsRequired=true)
public var parameters:[String:String]
required public init(){}
}
// @DataContract
public class PutUserAffiliateTokensResponse : BaseResponse
{
// @DataMember
public var success:Bool
// @DataMember
public var affiliateTokensId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case success
case affiliateTokensId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
success = try container.decodeIfPresent(Bool.self, forKey: .success)
affiliateTokensId = try container.decodeIfPresent(String.self, forKey: .affiliateTokensId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if success != nil { try container.encode(success, forKey: .success) }
if affiliateTokensId != nil { try container.encode(affiliateTokensId, forKey: .affiliateTokensId) }
}
}
// @DataContract
public class BaseResponse : Codable
{
// @DataMember(Name="responseStatus")
public var responseStatus:ResponseStatus
required public init(){}
}
Swift PutUserAffiliateTokensRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /v4/user-affiliate-tokens/{guid} HTTP/1.1
Host: affiliation-api-zane.dev.platform.georiot.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
guid: String,
username: String,
parameters:
{
String: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
success: False,
affiliateTokensId: String,
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}