| POST | /customerarticle/fromarticle | Create CustomerArticle. | Create CustomerArticle. |
|---|
"use strict";
export class CustomerBase {
/** @param {{CustomerId?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,SubscribedToNewsletter?:boolean,PersonalIdentityNumber?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {?string} */
CustomerId;
/** @type {string} */
Firstname;
/** @type {string} */
Lastname;
/** @type {string} */
Email;
/** @type {string} */
Phone;
/** @type {boolean} */
SubscribedToNewsletter;
/** @type {string} */
PersonalIdentityNumber;
}
export class CustomerToHandle extends CustomerBase {
/** @param {{CustomerId?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,SubscribedToNewsletter?:boolean,PersonalIdentityNumber?:string}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
}
export class InvoiceAddressToHandle {
/** @param {{CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CorporateIdentityNumber;
/** @type {string} */
InvoiceAddress1;
/** @type {string} */
InvoiceAddress2;
/** @type {string} */
InvoiceCity;
/** @type {string} */
InvoicePostalCode;
/** @type {string} */
InvoiceCountryCode;
}
export class FromArticleBase {
/** @param {{CompanyId?:string,ArticleId?:number,Customer?:CustomerToHandle,InvoiceAddress?:InvoiceAddressToHandle}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {?string} */
CompanyId;
/**
* @type {number}
* @description Article ID for the rebate code */
ArticleId;
/**
* @type {CustomerToHandle}
* @description Customer information */
Customer;
/**
* @type {InvoiceAddressToHandle}
* @description If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. */
InvoiceAddress;
}
export class BaseModel {
constructor(init) { Object.assign(this, init) }
}
export class ArticleServiceRelation extends BaseModel {
/** @param {{CompanyId?:string,Id?:number,ServiceId?:number,ArticleId?:number}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/** @type {string} */
CompanyId;
/** @type {number} */
Id;
/** @type {number} */
ServiceId;
/** @type {number} */
ArticleId;
}
export class ArticleResponse {
/** @param {{CompanyId?:string,Id?:number,Name?:string,ArticleTypeId?:number,Description?:string,ImageUrl?:string,Active?:boolean,Amount?:number,Price?:number,CurrencyId?:string,SortOrder?:number,UpdatedDate?:string,CreatedDate?:string,Services?:ArticleServiceRelation[],ServiceIds?:number[],PriceSign?:string,VAT?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CompanyId;
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {number} */
ArticleTypeId;
/** @type {string} */
Description;
/** @type {string} */
ImageUrl;
/** @type {boolean} */
Active;
/** @type {number} */
Amount;
/** @type {number} */
Price;
/** @type {string} */
CurrencyId;
/** @type {number} */
SortOrder;
/** @type {string} */
UpdatedDate;
/** @type {string} */
CreatedDate;
/** @type {ArticleServiceRelation[]} */
Services = [];
/** @type {number[]} */
ServiceIds = [];
/** @type {string} */
PriceSign;
/** @type {?number} */
VAT;
}
export class CustomerArticleCustomerResponse {
/** @param {{Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Firstname;
/** @type {string} */
Lastname;
/** @type {string} */
Email;
/** @type {string} */
Phone;
}
export class CustomerArticleCompanyResponse {
/** @param {{Id?:string,Name?:string,LogoType?:string,Email?:string,Phone?:string,City?:string,Street1?:string,ZipCode?:string,CountryId?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Name;
/** @type {string} */
LogoType;
/** @type {string} */
Email;
/** @type {string} */
Phone;
/** @type {string} */
City;
/** @type {string} */
Street1;
/** @type {string} */
ZipCode;
/** @type {string} */
CountryId;
}
export class PaymentLogResponse {
/** @param {{Id?:number,Amount?:number,AmountCredited?:number,CurrencyId?:string,Comments?:string,Created?:string,Updated?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {?number} */
Amount;
/** @type {?number} */
AmountCredited;
/** @type {string} */
CurrencyId;
/** @type {string} */
Comments;
/** @type {string} */
Created;
/** @type {string} */
Updated;
}
export class CustomerArticleResponse {
/** @param {{Id?:number,CompanyId?:string,ArticleId?:number,Price?:number,VAT?:number,CurrencyId?:string,StatusId?:number,StatusName?:string,CustomerId?:string,CreatedDate?:string,UpdatedDate?:string,Article?:ArticleResponse,Customer?:CustomerArticleCustomerResponse,Company?:CustomerArticleCompanyResponse,PaymentLog?:PaymentLogResponse[],ResponseStatus?:ResponseStatus}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
CompanyId;
/** @type {?number} */
ArticleId;
/** @type {?number} */
Price;
/** @type {?number} */
VAT;
/** @type {string} */
CurrencyId;
/** @type {number} */
StatusId;
/** @type {string} */
StatusName;
/** @type {?string} */
CustomerId;
/** @type {string} */
CreatedDate;
/** @type {string} */
UpdatedDate;
/** @type {ArticleResponse} */
Article;
/** @type {CustomerArticleCustomerResponse} */
Customer;
/** @type {CustomerArticleCompanyResponse} */
Company;
/** @type {PaymentLogResponse[]} */
PaymentLog = [];
/** @type {ResponseStatus} */
ResponseStatus;
}
export class CreateCustomerArticleFromArticle extends FromArticleBase {
/** @param {{CompanyId?:string,ArticleId?:number,Customer?:CustomerToHandle,InvoiceAddress?:InvoiceAddressToHandle}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
}
JavaScript CreateCustomerArticleFromArticle 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 /customerarticle/fromarticle HTTP/1.1
Host: testapi.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
ArticleId: 0,
Customer:
{
CustomerId: 00000000-0000-0000-0000-000000000000,
Firstname: String,
Lastname: String,
Email: String,
Phone: String,
SubscribedToNewsletter: False,
PersonalIdentityNumber: String
},
InvoiceAddress:
{
CorporateIdentityNumber: String,
InvoiceAddress1: String,
InvoiceAddress2: String,
InvoiceCity: String,
InvoicePostalCode: String,
InvoiceCountryCode: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Id: 0,
ArticleId: 0,
Price: 0,
VAT: 0,
CurrencyId: String,
StatusId: 0,
StatusName: String,
CustomerId: 00000000-0000-0000-0000-000000000000,
Article:
{
Id: 0,
Name: String,
ArticleTypeId: 0,
Description: String,
ImageUrl: String,
Active: False,
Amount: 0,
Price: 0,
CurrencyId: String,
SortOrder: 0,
Services:
[
{
Id: 0,
ServiceId: 0,
ArticleId: 0
}
],
ServiceIds:
[
0
],
PriceSign: String,
VAT: 0
},
Customer:
{
Firstname: String,
Lastname: String,
Email: String,
Phone: String
},
Company:
{
Name: String,
LogoType: String,
Email: String,
Phone: String,
City: String,
Street1: String,
ZipCode: String,
CountryId: String
},
PaymentLog:
[
{
Id: 0,
Amount: 0,
AmountCredited: 0,
CurrencyId: String,
Comments: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}