BokaMera.API.Host

<back to all web services

CreateArticle

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/articlesAdd new articleAdd article to the company for the currently logged in user

export class BaseModel
{

    public constructor(init?: Partial<BaseModel>) { (Object as any).assign(this, init); }
}

export class ArticleServiceRelation extends BaseModel
{
    // @Required()
    public CompanyId: string;

    public Id: number;
    // @Required()
    public ServiceId: number;

    // @Required()
    public ArticleId: number;

    public constructor(init?: Partial<ArticleServiceRelation>) { super(init); (Object as any).assign(this, init); }
}

export class ArticleResponse
{
    public CompanyId: string;
    public Id: number;
    public Name: string;
    public ArticleTypeId: number;
    public Description: string;
    public ImageUrl: string;
    public Active: boolean;
    public Amount: number;
    public Price: number;
    public CurrencyId: string;
    public UpdatedDate: string;
    public CreatedDate: string;
    public Services: ArticleServiceRelation[];
    public ServiceIds: number[];
    public PriceSign: string;

    public constructor(init?: Partial<ArticleResponse>) { (Object as any).assign(this, init); }
}

export class CreateArticle
{
    /** @description  */
    // @ApiMember(Description="")
    public CompanyId?: string;

    /** @description  */
    // @ApiMember(Description="", IsRequired=true)
    public Name: string;

    /** @description  */
    // @ApiMember(Description="", IsRequired=true)
    public ArticleTypeId: number;

    /** @description  */
    // @ApiMember(Description="", IsRequired=true)
    public Description: string;

    /** @description  */
    // @ApiMember(Description="")
    public ImageUrl: string;

    /** @description  */
    // @ApiMember(Description="", IsRequired=true)
    public Active: boolean;

    /** @description  */
    // @ApiMember(Description="", IsRequired=true)
    public Amount: number;

    /** @description . */
    // @ApiMember(Description=".", IsRequired=true)
    public Price: number;

    /** @description The payment currency id */
    // @ApiMember(Description="The payment currency id", IsRequired=true)
    public CurrencyId: string;

    /** @description Query for specific services. */
    // @ApiMember(Description="Query for specific services.", ParameterType="query")
    public ServiceIds: number[];

    public constructor(init?: Partial<CreateArticle>) { (Object as any).assign(this, init); }
}

TypeScript CreateArticle DTOs

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

HTTP + JSV

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

POST /articles HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Name: String,
	ArticleTypeId: 0,
	Description: String,
	Active: False,
	Amount: 0,
	Price: 0,
	CurrencyId: String,
	ServiceIds: 
	[
		0
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Name: String,
	ArticleTypeId: 0,
	Description: String,
	ImageUrl: String,
	Active: False,
	Amount: 0,
	Price: 0,
	CurrencyId: String,
	Services: 
	[
		{
			Id: 0,
			ServiceId: 0,
			ArticleId: 0
		}
	],
	ServiceIds: 
	[
		0
	],
	PriceSign: String
}