Primavera Lithium Canonical Data Service (CDS) Client Library

The Canonical Data Service allows retrieving data from the canonical data model (parties, products, sales invoices, etc.).

REST Service Client

Class Description
CanonicalDataClient The entry point of the Canonical Data Service client library.

Client Controllers

Class Description
Parties The parties controller.
Products The products controller.
SalesInvoices The sales invoices controller.

Models

Class Description
Page Defines the base class for a paginated response.
PartiesBillingAddress Defines a party billing address.
PartiesShippingAddress Defines a party shipping address.
PartiesValues Defines a party.
ProductsValues Defines a product.
SalesInvoiceDocumentTotals Defines a sales invoice totals.
SalesInvoiceDocumentTotalsPayment Defines a sales invoice totals payment.
SalesInvoiceLine Defines a sales invoice line.
SalesInvoiceLineTax Defines a sales invoice line tax.
SalesInvoicesDocumentStatus Describes a sales invoices document status.
SalesInvoicesPage Defines a sales invoices paginated response.
SalesInvoicesShipFrom Defines a sales invoice shipping origin.
SalesInvoicesShippingAddress Defines a sales invoice shipping address.
SalesInvoicesShipTo Defines a sales invoice shipping destination.
SalesInvoicesSpecialRegimes Describes a sales invoices special regimes.
SalesInvoicesValues Defines a sales invoice.
SalesInvoiceWithholdingTax Defines a sales invoice withholding tax.

Enumerations

The client library has no enumerations.

Authorization Policies

Policy Description Scope
DefaultScope Defines an authorization policy that requires the default scope. lithium-canonicaldataservice

Reference

REST Service Client Classes

CanonicalDataClient

Constructors
CanonicalDataClient(Uri, BearerTokenCredential)
Parameter Type Description
serviceUri Uri The service URI.
credential BearerTokenCredential The credential that should be used to access the service.
CanonicalDataClient(Uri, BearerTokenCredential, CanonicalDataClientOptions)
Parameter Type Description
serviceUri Uri The service URI.
credential BearerTokenCredential The credential that should be used to access the service.
clientOptions CanonicalDataClientOptions The client options.
Example
Uri address = new Uri("[service-address]");
string clientId = "[client-id]"
string clientSecret = "[client-secret]"

CanonicalDataClient client = new CanonicalDataClient(
    new Uri(address),
    new ChallengeCredential(
        async (args, cancellationToken) =>
        {
            ClientSecretCredential innerCredential = new ClientSecretCredential(
                args.AuthorizationUri,
                clientId,
                clientSecret);

            return await innerCredential.GetTokenAsync(cancellationToken).ConfigureAwait(false);
        }));

^ Back to top

Client Controllers Classes

PartiesClientController

The parties controller.

Methods
ReadPartiesAsync()

Reads a collection of parties.

public async Task<RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues>>> ReadPartiesAsync(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize, CancellationToken cancellationToken = default);

public RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues>> ReadParties(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize);
Parameters
Parameter Type Description Rules
importId string The import identifier. Required.
pageIndex int The page index.
pageSize int The page size.
Returns
Return Type Description
System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues> The collection of parties.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

ReadPartyAsync()

Reads a party.

public async Task<RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues>> ReadPartyAsync(string physicalKey, string businessKey, string itemKey, string importId, CancellationToken cancellationToken = default);

public RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues> ReadParty(string physicalKey, string businessKey, string itemKey, string importId);
Parameters
Parameter Type Description Rules
itemKey string The item key. Required.
importId string The import identifier. Required.
Returns
Return Type Description
Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesValues The party.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

ProductsClientController

The products controller.

Methods
ReadProductAsync()

Reads a product.

public async Task<RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues>> ReadProductAsync(string physicalKey, string businessKey, string itemKey, string importId, CancellationToken cancellationToken = default);

public RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues> ReadProduct(string physicalKey, string businessKey, string itemKey, string importId);
Parameters
Parameter Type Description Rules
itemKey string The item key. Required.
importId string The import identifier. Required.
Returns
Return Type Description
Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues The product.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

ReadProductsAsync()

Reads a collection of products.

public async Task<RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues>>> ReadProductsAsync(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize, CancellationToken cancellationToken = default);

public RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues>> ReadProducts(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize);
Parameters
Parameter Type Description Rules
importId string The import identifier. Required.
pageIndex int The page index.
pageSize int The page size.
Returns
Return Type Description
System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.ProductsValues> The collection of products.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

SalesInvoicesClientController

The sales invoices controller.

Methods
ReadSalesInvoiceAsync()

Reads a sales invoice.

public async Task<RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues>> ReadSalesInvoiceAsync(string physicalKey, string businessKey, string itemKey, string importId, CancellationToken cancellationToken = default);

public RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues> ReadSalesInvoice(string physicalKey, string businessKey, string itemKey, string importId);
Parameters
Parameter Type Description Rules
itemKey string The item key. Required.
importId string The import identifier. Required.
Returns
Return Type Description
Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues The sales invoice.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

ReadSalesInvoicesAsync()

Reads a collection of sales invoices.

public async Task<RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues>>> ReadSalesInvoicesAsync(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize, CancellationToken cancellationToken = default);

public RestServiceResult<System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues>> ReadSalesInvoices(string physicalKey, string businessKey, string importId, int pageIndex, int pageSize);
Parameters
Parameter Type Description Rules
importId string The import identifier. Required.
pageIndex int The page index.
pageSize int The page size.
Returns
Return Type Description
System.Collections.Generic.IEnumerable<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues> The collection of sales invoices.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.
HttpStatusCode.NotFound Failure: not found.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

SearchAsync()

Searches for a collection of sales invoices.

public async Task<RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesPage>> SearchAsync(string physicalKey, string businessKey, string importId, int pageSize, string? continuationToken, CancellationToken cancellationToken = default);

public RestServiceResult<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesPage> Search(string physicalKey, string businessKey, string importId, int pageSize, string? continuationToken);
Parameters
Parameter Type Description Rules
importId string The import identifier. Required.
pageSize int The page size. > 0. < 129.
continuationToken string? The continuation token.
Returns
Return Type Description
Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesPage The collection of sales invoices.
Status Codes
Status Code Description
HttpStatusCode.Ok Success.
HttpStatusCode.BadRequest Failure: the request is invalid.

The operation will raise RestRequestException for any failure status code. The exception may include a body with a RestServiceError depending on the status code.

^ Back to top

Models Classes

Page

Defines the base class for a paginated response.

Properties
Property Type Description Rules
ContinuationToken string The continuation token for subsequent requests. Required.

^ Back to top

PartiesBillingAddress

Defines a party billing address.

Properties
Property Type Description Rules
AddressDetail string The party billing address detail. Required.
City string The party billing address city. Required.
PostalCode string The party billing address postal code. Required.
Country string The party billing address country. Required.
BuildingNumber string The party billing address building number. Required.
Region string The party billing address region. Required.
StreetName string The party billing address street name. Required.

^ Back to top

PartiesShippingAddress

Defines a party shipping address.

Properties
Property Type Description Rules
AddressDetail string The party shipping address details. Required.
City string The party shipping address city. Required.
PostalCode string The party shipping address postal code. Required.
Country string The party shipping address country. Required.
StreetName string The party shipping address street name. Required.
Region string The party shipping address region. Required.
BuildingNumber string The party shipping address building number. Required.

^ Back to top

PartiesValues

Defines a party.

Properties
Property Type Description Rules
PartyID string The party identifier. Required.
AccountID string The party account identifier. Required.
TaxID string The party tax identifier. Required.
CompanyName string The party company name. Required.
Telephone string? The party telephone.
Fax string? The party fax.
Website string? The party website.
PartyType string? The party type.
CAE string? The party economic activity classification.
SelfBillingIndicator int? The party self-billing indicator.
BillingAddress Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesBillingAddress The party billing address. Required.
ShippingAddress Primavera.Lithium.CanonicalData.Client.Rest.Models.PartiesShippingAddress? The party shipping address.
Email string The party e-mail. Required.

The model includes custom properties not described here.

^ Back to top

ProductsValues

Defines a product.

Properties
Property Type Description Rules
ProductKey string The product key. Required.
ProductType string The product type. Required.
ProductGroup string The product group. Required.
ProductDescription string The product description. Required.
ProductNumberCode string The product number code. Required.

^ Back to top

SalesInvoiceDocumentTotals

Defines a sales invoice totals.

Properties
Property Type Description Rules
TaxPayable double? The sales invoice payable tax total.
NetTotal double? The sales invoice net total.
GrossTotal double? The sales invoice gross total.
Payment Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoiceDocumentTotalsPayment The sales invoice total payment. Required.

^ Back to top

SalesInvoiceDocumentTotalsPayment

Defines a sales invoice totals payment.

Properties
Property Type Description Rules
PaymentMechanism string The sales invoice totals payment mechanism. Required.
PaymentAmount double? The sales invoice totals payment amount.
PaymentDate string The sales invoice totals payment date. Required.

^ Back to top

SalesInvoiceLine

Defines a sales invoice line.

Properties
Property Type Description Rules
LineNumber int? The sales invoice line number.
ProductCode string The sales invoice line product code. Required.
ProductDescription string The sales invoice line product description. Required.
Quantity double? The sales invoice line quantity.
UnitOfMeasure string The sales invoice line measure unit. Required.
UnitPrice double? The sales invoice line unit price.
TaxBase double? The sales invoice line base tax.
TaxPointDate string The sales invoice line tax point date. Required.
Description string The sales invoice line description. Required.
SerialNumber string The sales invoice line serial number. Required.
CreditAmount double? The sales invoice line credit amount.
DebitAmount double? The sales invoice line debit amount.
Tax Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoiceLineTax The sales invoice line tax. Required.
SettlementAmount double? The sales invoice line settlement amount.
TaxExemptionReason string The sales invoice line tax exemption reason. Required.
TaxExemptionCode string The sales invoice line tax exemption code. Required.

^ Back to top

SalesInvoiceLineTax

Defines a sales invoice line tax.

Properties
Property Type Description Rules
TaxType string The sales invoice line tax type. Required.
TaxCountryRegion string The sales invoice line tax country region. Required.
TaxCode string The sales invoice line tax code. Required.
TaxPercentage double? The sales invoice line tax percentage.
TaxAmount double? The sales invoice line tax amount.

^ Back to top

SalesInvoicesDocumentStatus

Describes a sales invoices document status.

Properties
Property Type Description Rules
InvoiceStatus string The sales invoice status. Required.
InvoiceStatusDate string The sales invoice status date. Required.
SourceBilling string The sales invoice billing source. Required.
SourceID string The sales invoice source identifier. Required.

^ Back to top

SalesInvoicesPage

Defines a sales invoices paginated response.

Properties
Property Type Description Rules
Items System.Collections.Generic.IList<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesValues> The collection of sales invoices. Required.

^ Back to top

SalesInvoicesShipFrom

Defines a sales invoice shipping origin.

Properties
Property Type Description Rules
Address Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesShippingAddress The sales invoice shipping origin address. Required.

^ Back to top

SalesInvoicesShippingAddress

Defines a sales invoice shipping address.

Properties
Property Type Description Rules
StreetName string The sales invoice shipping address street name. Required.
AddressDetail string The sales invoice shipping address details. Required.
City string The sales invoice shipping address city. Required.
PostalCode string The sales invoice shipping address postal code. Required.
Region string The sales invoice shipping address region. Required.
Country string The sales invoice shipping address country. Required.
BuildingNumber string The sales invoice shipping address building number. Required.

^ Back to top

SalesInvoicesShipTo

Defines a sales invoice shipping destination.

Properties
Property Type Description Rules
Address Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesShippingAddress The sales invoice shipping destination address. Required.

^ Back to top

SalesInvoicesSpecialRegimes

Describes a sales invoices special regimes.

Properties
Property Type Description Rules
SelfBillingIndicator int? The sales invoice self-billing indicator.
CashVATSchemeIndicator int? The sales invoice cash value-added tax scheme indicator.
ThirdPartiesBillingIndicator int? The sales invoice third-parties billing indicator.

^ Back to top

SalesInvoicesValues

Defines a sales invoice.

Properties
Property Type Description Rules
InvoiceNo string The sales invoice number. Required.
Atcud string The sales invoice unique document code. Required.
DocumentStatus Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesDocumentStatus The sales invoice document status. Required.
Hash string The sales invoice hash. Required.
HashControl string The sales invoice hash control. Required.
Period int? The sales invoice period.
InvoiceDate string The sales invoice date. Required.
InvoiceType string The sales invoice type. Required.
SpecialRegimes Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesSpecialRegimes The sales invoice special regimes. Required.
SourceID string The sales invoice source identifier. Required.
TransactionID string The sales invoice transaction identifier. Required.
SystemEntryDate string The sales invoice system entry date. Required.
CustomerID string The sales invoice customer identifier. Required.
ShipTo Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesShipTo The sales invoice shipping destination address. Required.
ShipFrom Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoicesShipFrom The sales invoice shipping origin address. Required.
MovementStartTime string The sales invoice movement start time. Required.
Line System.Collections.Generic.IList<Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoiceLine> The sales invoice line. Required.
DocumentTotals Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoiceDocumentTotals The sales invoice document totals. Required.
WithholdingTax Primavera.Lithium.CanonicalData.Client.Rest.Models.SalesInvoiceWithholdingTax The sales invoice withholding tax. Required.
SoftwareCertificateNumber string The sales invoice software certificate number. Required.

^ Back to top

SalesInvoiceWithholdingTax

Defines a sales invoice withholding tax.

Properties
Property Type Description Rules
WithholdingTaxType string The sales invoice withholding tax type. Required.
WithholdingTaxDescription string The sales invoice withholding tax description. Required.
WithholdingTaxAmount double? The sales invoice withholding tax amount.

^ Back to top