| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| PUT | /articles/mappings | Update external article mappings for the company articles | Create or update mappings between BokaMera articles and articles in an external system, for example e-accounting |
|---|
<?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 ArticleMappingToHandle implements JsonSerializable
{
public function __construct(
/** @description The id of an existing mapping to update; leave empty to create a new one */
// @ApiMember(Description="The id of an existing mapping to update; leave empty to create a new one")
/** @var string|null */
public ?string $Id=null,
/** @description The BokaMera article id */
// @ApiMember(Description="The BokaMera article id")
/** @var int */
public int $ArticleId=0,
/** @description The Reference Type: StripeArticle = 1, EAccountingArticle = 2 */
// @ApiMember(Description="The Reference Type: StripeArticle = 1, EAccountingArticle = 2")
/** @var string */
public string $ReferenceType='',
/** @description The external reference; Values for EAccountingArticle, StripeArticle */
// @ApiMember(Description="The external reference; Values for EAccountingArticle, StripeArticle")
/** @var string */
public string $ExternalReference=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
if (isset($o['ReferenceType'])) $this->ReferenceType = $o['ReferenceType'];
if (isset($o['ExternalReference'])) $this->ExternalReference = $o['ExternalReference'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
if (isset($this->ReferenceType)) $o['ReferenceType'] = $this->ReferenceType;
if (isset($this->ExternalReference)) $o['ExternalReference'] = $this->ExternalReference;
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateArticleMappings implements ICompany, JsonSerializable
{
public function __construct(
/** @description Company to update article mappings for */
// @ApiMember(Description="Company to update article mappings for")
/** @var string|null */
public ?string $CompanyId=null,
/** @description The article mappings to create or update */
// @ApiMember(Description="The article mappings to create or update", IsRequired=true)
/** @var array<ArticleMappingToHandle>|null */
public ?array $ArticleMappings=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['ArticleMappings'])) $this->ArticleMappings = JsonConverters::fromArray('ArticleMappingToHandle', $o['ArticleMappings']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->ArticleMappings)) $o['ArticleMappings'] = JsonConverters::toArray('ArticleMappingToHandle', $this->ArticleMappings);
return empty($o) ? new class(){} : $o;
}
}
PHP UpdateArticleMappings DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /articles/mappings HTTP/1.1
Host: testapi.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","ArticleMappings":[{"Id":"00000000-0000-0000-0000-000000000000","ArticleId":0,"ReferenceType":"String","ExternalReference":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
[{"ArticleId":0,"ExternalReference":"String","ReferenceType":"String"}]