Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CRS public API is exposed via Swagger by following URL:

{host_url}/swagger/{microservice_name}/uiswagger/index

where {host_url}- URL of CRS instance to integrate (for example, https://prodshadowprod02shadow.cloudretailsystems.dk/),

{microservice_name} - name of microservice, which feature is supposed to be used. In scope of web shop integration following microservice names will be used:

...

Also it is worth to read following document in order to get short CRS API reference: /wiki/spaces/MBSG/pages/44512

Basic information for all requests

HTTP word - POST

All requests should contain header Content-Type - application/json.

Work with Get[Something]Page requests

...

Code Block
languagejs
{  
   {  
      "id":actor_id,
      "propertiesToLoad":  { "value": <write flags 11111111111111value> }
   }
}

[propertiesToLoad] - flag enumeration with following options:

Code Block
languagejs
FieldSet = 1,
WebAddresses = 2,
Emails = 4,
Addresses = 8,
Fields = 16,
Groups = 32,
Phones = 64,
Roles = 128,
User = 256,
Relations = 512,
PaymentInfo = 1024,
WorkingHours = 2048,
ExternalDataRecord = 4096

If all actor properties needed properties E.g. to load should be FieldSet | WebAddresses | Emails  and so on  - 1111111111111 in resultand Email we need to either use bit AND operation or just sum, so 1+4=5 in our case.

[propertiesToLoad] is an optional property, if it will is not be defined , all actor properties will be loaded.

...

Code Block
languagejs
{ 
   "sortInfo":[
   ],
   "propertiesToLoad": <write 11111111111111flags value>,
   "offset":0,
   "count":page_size,
   "includeOverallEntryCount":true
}

...

[RoleSystemName]- allows to filter actors by specific role
[SearchPattern] - allows to filter actor whcich which person or organization name, phone, email or customer identifier satisfies search pattern
[ModifiedAtFrom] - allows to filter actors modified after specific timestamp
[ModifiedAtTo] - allows to filter actors modified before specific timestamp

...

Code Block
languagejs
{
   "sortInfo":[
   ],
   "propertiesToLoad": <write flags 111111111111value>,
   "offset":0,
   "count":50,
   "includeOverallEntryCount":true,
   "roleSystemName":{
       "value":"Customer"
    }
}

...

Code Block
languagejs
{
   "sortInfo":[
   ],
   "propertiesToLoad": <write 111111111111flags value>,
   "offset":0,
   "count":50,
   "includeOverallEntryCount":true,
   "roleSystemName":{
       "value":"Supplier"
    }
}

...

Code Block
languagejs
{
    "sortInfo": [],
    "propertiesToLoad": 1111111111111<write flags value>,
    "offset": 0,
    "count": 50,
    "includeOverallEntryCount": true,
    "modifiedAtFrom": {
        "value": "2020-01-01T18:25:43.511Z"
    },
    "modifiedAtTo": {
        "value": "2021-01-01T18:25:43.511Z"
    },
    "searchPattern": {
        "value": "aa"
    }
}

...

Code Block
languagejs
{
	"propertiesToLoad": {
		"value": <write flags 1111111111111value>
	},
	"offset": 0,
	"count": page_size,
	"includeOverallEntryCount": true,
	"modifiedAfter": {
		"value": "2017-09-26T12:52:29.960Z"
	}
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateSalesOrderItemModelUpdate",
         "financialData":{  
            "priceIncludesVat" // should always be true,
            "saleFinancialAccountNumber" // [financial_account_number],
            "vatAccountNumber" // should be taken from [vat_type] if presented, else - undefined
            "vatRate" // should be taken from [vat_type] if presented, else - undefined
            "discountAccountNumber" // should be taken from [vat_type] if presented, else - undefined
            "usedVatFinancialAccountNumber" // should be taken from [vat_type] else - undefined
            "usedVatRate" // should be taken from [vat_type] if presented, else - undefined
         },
         "manualDiscountAmount" // [manual_discount]
         "quantity" // [quantity],
         "inventoryItemData":{  
            "displayName" // from [product]
            "productId" // from [product]
            "variantId" // from [product_instance] if presented, , else - undefined,
            "instanceId" // from [product_instance] if presented, else - undefined
            "productIdentifier" // from [product_variant]
            "isUserDefinedPriceAllowed // from [product]
            "isCustomDisplayNameAllowed // from [product]
            "costPrice" // [cost_price]
            "isUsed"from [product_instance] if presented, else - undefined
            "purchasePrice" //from [product_instance] if presented, else - undefined
            "isProductInstanceRequired" from product.isProductInstancesSupported
         },
         "price" - [sales_price]
      },
      {  
         "modelType":"SetSalesOrderCustomerDataModelUpdate",
         "actor":{ // this entire block may be undefined if [customer] is not defined 
            "value":{  
               "actorId"// from [customer]
               "fullName"// Property [ActorText] from [customer]
               "identification// Customer Identifier (from [customer])
            }
         },
         "address":{  // this entire block may be undefined if [address] is not defined 
            "value":{  
               "addressLine1" // from [address], required
               "addressLine2" // from [address]
               "postalCode" // from [address], required
               "postalDistrict" // from [address]
               "country" // from [address], required
               "latitude" // from [address]
               "longitude" // from [address]
            }
         },
         "email":{   // this entire block may be undefined if [email] is not defined 
            "value" // [email] itself
         },
         "phone":{  // this entire block may be undefined if [phone]  is not defined 
            "value" // [phone] itself
         }
      }
   ],
   "modelType":"CreateSalesOrderCommand"
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateSalesOrderItemModelUpdate",
         "financialData":{  
            "priceIncludesVat":true,
            "saleFinancialAccountNumber":1100,
            "vatAccountNumber":14262,
            "vatRate":25,
            "discountAccountNumber":7200,
            "usedVatFinancialAccountNumber":null,
            "usedVatRate":null
         },
         "manualDiscountAmount":300.14,
         "quantity":1,
         "inventoryItemData":{  
            "displayName":"Sony Playstation 4 (cf18-4136-9f92-31764c4)",
            "productId":106,
            "variantId":null,
            "instanceId":165,
            "productIdentifier":"ID_108",
            "isUserDefinedPriceAllowed":false,
            "isCustomDisplayNameAllowed":false,
            "costPrice":3000,
            "isUsed":false,
            "purchasePrice":null,
            "isProductInstanceRequired": true
         },
         "price":3001.45
      },
      {  
         "modelType":"SetSalesOrderCustomerDataModelUpdate",
         "actor":{  
            "value":{  
               "actorId":8,
               "fullName":"0000100001 a_person Customer",
               "identification":"0000100001"
            }
         },
         "address":{  
            "value":{  
               "addressLine1":"myStreet",
               "addressLine2":"222",
               "postalCode":"2100",
               "postalDistrict":"København Ø",
               "country":"Denmark",
               "latitude":null,
               "longitude":null,
            }
         },
         "email":{  
            "value":"example@gmail.com"
         },
         "phone":{  
            "value":"77777777"
         }
      }
   ],
   "modelType":"CreateSalesOrderCommand"
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateInvoiceItemModelUpdate",
         "financialData":{  
            "priceIncludesVat" // should always be true,
            "saleFinancialAccountNumber" // [financial_account_number],
            "vatAccountNumber" // should be taken from [vat_type] if presented, else - undefined
            "vatRate" // should be taken from [vat_type] if presented, else - undefined
            "discountAccountNumber" // should be taken from [vat_type] if presented, else - undefined
            "usedVatFinancialAccountNumber" // should be taken from [vat_type] else - undefined
            "usedVatRate" // should be taken from [vat_type] if presented, else - undefined
         },
         "manualDiscountAmount" // [manual_discount]
         "quantity" // [quantity],
         "inventoryItemData":{  
            "displayName" // from [product]
            "productId" // from [product]
            "variantId" // from [product_instance] if presented, , else - undefined,
            "instanceId" // from [product_instance] if presented, else - undefined
            "productIdentifier" // from [product_variant]
            "isUserDefinedPriceAllowed // from [product]
            "isCustomDisplayNameAllowed // from [product]
            "costPrice" // from [product_instance] if presented, else - undefined
            "isUsed"from [product_instance] if presented, else - undefined
            "purchasePrice" //from [product_instance] if presented, else - undefined
            "isProductInstanceRequired" from product.isProductInstancesSupported
         },
         "price" - [sales_price]
      },
      {  
         "modelType":"SetInvoiceCustomerDataModelUpdate",
         "actor":{ // this entire block may be undefined if [customer] is not defined 
            "value":{  
               "actorId"// from [customer]
               "fullName"// from [customer]
               "identification// from [customer]
            }
         },
         "address":{  // this entire block may be undefined if [address] is not defined 
            "value":{  
               "addressLine1" // from [address], required
               "addressLine2" // from [address]
               "postalCode" // from [address], required
               "postalDistrict" // from [address]
               "country" // from [address], required
               "latitude" // from [address]
               "longitude" // from [address]
            }
         },
         "email":{   // this entire block may be undefined if [email] is not defined 
            "value" // [email] itself
         },
         "phone":{  // this entire block may be undefined if [phone]  is not defined 
            "value" // [phone] itself
         }
      }
   ],
   "modelType":"CreateInvoiceAndReserveCommand"
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateInvoiceItemModelUpdate",
         "financialData":{  
            "priceIncludesVat":true,
            "saleFinancialAccountNumber":1100,
            "vatAccountNumber":14262,
            "vatRate":25,
            "discountAccountNumber":7200,
            "usedVatFinancialAccountNumber":null,
            "usedVatRate":null
         },
         "manualDiscountAmount":300.14,
         "quantity":1,
         "inventoryItemData":{  
            "displayName":"Sony Playstation 4 (cf18-4136-9f92-31764c4)",
            "productId":106,
            "variantId":null,
            "instanceId":165,
            "productIdentifier":"ID_108",
            "isUserDefinedPriceAllowed":false,
            "isCustomDisplayNameAllowed":false,
            "costPrice":3000,
            "isUsed":false,
            "purchasePrice":null,
            "isProductInstanceRequired": true
         },
         "price":3001.45
      },
      {  
         "modelType":"SetInvoiceCustomerDataModelUpdate",
         "actor":{  
            "value":{  
               "actorId":8,
               "fullName":"0000100001 a_person Customer",
               "identification":"0000100001"
            }
         },
         "address":{  
            "value":{  
               "addressLine1":"myStreet",
               "addressLine2":"222",
               "postalCode":"2100",
               "postalDistrict":"København Ø",
               "country":"Denmark",
               "latitude":null,
               "longitude":null,
            }
         },
         "email":{  
            "value":"example@gmail.com"
         },
         "phone":{  
            "value":"77777777"
         }
      }
   ],
   "modelType":"CreateInvoiceAndReserveCommand"
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateInvoiceItemModelUpdate",
         "salesOrderItemReference":{  
            "value":{  
               "salesOrderId" // from [sale_order]
               "salesOrderIdentifier // from [sale_order]
               "salesOrderItemId" // from [sale_order_item]
            }
         },
         "financialData":{  // just copy from property with same name from [sale_order_item] or change if needed
            "saleFinancialAccountNumber"
            "vatRate"
            "vatAccountNumber"
            "discountAccountNumber"
            "priceIncludesVat"
            "usedVatRate"
            "usedVatFinancialAccountNumber"
         },
         "manualDiscountAmount"// just copy from property with same name from [sale_order_item] or change if needed
         "quantity"// just copy from property with same name from [sale_order_item] or change if needed
         "inventoryItemData":{  // just copy from property with same name from [sale_order_item] or change if needed
            "displayName"
            "productId"
            "variantId"
            "instanceId"
            "productIdentifier"
            "isUserDefinedPriceAllowed"
            "isCustomDisplayNameAllowed"
            "costPrice"
            "isUsed"
            "purchasePrice",
            "isProductInstanceRequired"
         },
         "price"// just copy from property with same name from [sale_order_item] or change if needed
      },
      {  
         "modelType":"SetInvoiceCustomerDataModelUpdate",
         "customerDescriptor":{  // copy from property [customer] of [sale_order] or compose based on [customer]
            "value":{  
               "actorId"
               "fullName"
               "identification"
            }
         },
         "firstName":{  
            "value" // take from [customer] if possible or user input
         },
         "lastName":{  
            "value" // take from [customer] if possible or user input
         },
         "organizationName":{  
            "value" // take from [customer] if possible or user input
         },
         "address":{ // take from [customer] if possible or user input  
            "value":{  
               "addressLine1"
               "addressLine2"
               "postalCode"
               "postalDistrict"
               "country"
               "latitude"
               "longitude"
            }
         },
         "email":{  
            "value" // take from [customer] if possible or user input
         },
         "phone":{  
            "value" // take from [customer] if possible or user input
         }
      }
   ],
   "modelType":"CreateInvoiceCommand"
}

...

Code Block
languagejs
{  
   "modelUpdates":[  
      {  
         "modelType":"CreateInvoiceItemModelUpdate",
         "salesOrderItemReference":{  
            "value":{  
               "salesOrderId":1,
               "salesOrderIdentifier":"0000000001",
               "salesOrderItemId":1
            }
         },
         "financialData":{  
            "saleFinancialAccountNumber":1100,
            "vatRate":25,
            "vatAccountNumber":14262,
            "discountAccountNumber":7200,
            "priceIncludesVat":true,
            "usedVatRate":null,
            "usedVatFinancialAccountNumber":null
         },
         "manualDiscountAmount":300.14,
         "quantity":1,
         "inventoryItemData":{  
            "displayName":"Sony Playstation 4 (cf18-4136-9f92-31764c4)",
            "productId":106,
            "variantId":null,
            "instanceId":165,
            "productIdentifier":"ID_108",
            "isUserDefinedPriceAllowed":false,
            "isCustomDisplayNameAllowed":false,
            "costPrice":3000,
            "isUsed":false,
            "purchasePrice":null,
            "isProductInstanceRequired": true
         },
         "price":3001.45
      },
      {  
         "modelType":"SetInvoiceCustomerDataModelUpdate",
         "customerDescriptor":{  
            "value":{  
               "actorId":8,
               "fullName":"0000100001 a_person Customer",
               "identification":"0000100001"
            }
         },
         "firstName":{  
            "value":"a_person"
         },
         "lastName":{  
            "value":"Customer"
         },
         "organizationName":{  
            "value":null
         },
         "ean":{  

         },
         "address":{  
            "value":{  
               "addressLine1":"myStreet",
               "addressLine2":"222",
               "postalCode":"2100",
               "postalDistrict":"København Ø",
               "country":"Denmark",
               "latitude":null,
               "longitude":null
            }
         },
         "email":{  
            "value":"example@gmail.com"
         },
         "phone":{  
            "value":"77777777"
         }
      },
      {  
         "modelType":"SetInvoiceProductInstanceModelUpdate",
         "productInstance":{  
            "productInstanceId":null,
            "displayValue":"",
            "productId":null,
            "productVariantId":null
         }
      },
      {  
         "modelType":"SetInvoicePaymentDueDateModelUpdate",
         "paymentDueDate":"2018-09-27T13:38:46+03:00"
      }
   ],
   "modelType":"CreateInvoiceCommand"
}

...