| POST | /v4/groups/{groupId}/group-affiliate-tokens | 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. |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class AffiliateTokensRequestBase implements JsonSerializable
{
public function __construct(
// @DataMember(Name="username", IsRequired=true)
/** @var string|null */
public ?string $username=null,
// @DataMember(Name="parameters", IsRequired=true)
/** @var array<string,string>|null */
public ?array $parameters=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['username'])) $this->username = $o['username'];
if (isset($o['parameters'])) $this->parameters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['parameters']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->username)) $o['username'] = $this->username;
if (isset($this->parameters)) $o['parameters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->parameters);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseResponse implements JsonSerializable
{
public function __construct(
// @DataMember(Name="responseStatus")
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class PostGroupAffiliateTokensResponse extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
// @DataMember
/** @var bool|null */
public ?bool $success=null,
// @DataMember
/** @var string|null */
public ?string $affiliateTokensId=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['success'])) $this->success = $o['success'];
if (isset($o['affiliateTokensId'])) $this->affiliateTokensId = $o['affiliateTokensId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->success)) $o['success'] = $this->success;
if (isset($this->affiliateTokensId)) $o['affiliateTokensId'] = $this->affiliateTokensId;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class PostGroupAffiliateTokensRequest extends AffiliateTokensRequestBase implements JsonSerializable
{
/**
* @param string|null $username
* @param array<string,string>|null $parameters
*/
public function __construct(
?string $username=null,
?array $parameters=null,
// @DataMember(Name="groupId", IsRequired=true)
/** @var int */
public int $groupId=0,
// @DataMember(Name="programGuid", IsRequired=true)
/** @var string|null */
public ?string $programGuid=null
) {
parent::__construct($username,$parameters);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['groupId'])) $this->groupId = $o['groupId'];
if (isset($o['programGuid'])) $this->programGuid = $o['programGuid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->groupId)) $o['groupId'] = $this->groupId;
if (isset($this->programGuid)) $o['programGuid'] = $this->programGuid;
return empty($o) ? new class(){} : $o;
}
}
PHP PostGroupAffiliateTokensRequest 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.
POST /v4/groups/{groupId}/group-affiliate-tokens HTTP/1.1
Host: affiliation-api-zane.dev.platform.georiot.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
groupId: 0,
programGuid: 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
}
}
}