BokaMera.API.Host

<back to all web services

ArticleMappingsQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin
The following routes are available for this service:
GET/articles/mappingsGet all external article mappings for the company articlesGet all 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};


// @ValidateRequest(Validator="IsAuthenticated")
class ArticleMappingsQuery implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description Company to show article mappings for */
        // @ApiMember(Description="Company to show article mappings for")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description The Reference Type to filter on: StripeArticle, EAccountingArticle */
        // @ApiMember(Description="The Reference Type to filter on: StripeArticle, EAccountingArticle")
        /** @var string */
        public string $ReferenceType='',

        /** @description Article to show mappings for */
        // @ApiMember(Description="Article to show mappings for")
        /** @var int|null */
        public ?int $ArticleId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ReferenceType'])) $this->ReferenceType = $o['ReferenceType'];
        if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ReferenceType)) $o['ReferenceType'] = $this->ReferenceType;
        if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ArticleMappingsQuery DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /articles/mappings HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

[{"ArticleId":0,"ExternalReference":"String","ReferenceType":"String"}]