Skip to main content

Actions

The ballerinax/sap.businessone.businesspartners package exposes the following clients:

Available clients:

ClientPurpose
ClientManages SAP Business One business partner master data — customers, vendors, leads, contacts, and their related setup entities — via the Service Layer OData API.

Client

The Client provides access to all business partner master data and related setup entities exposed by the SAP Business One Service Layer OData API — business partners, contacts, groups, properties, relationships, payment terms types, priorities, VAT exemptions, industries, territories, address services, and opening balances.

Configuration

sap.businessone:SessionConfig (required session credentials, passed as the first argument to new)

FieldTypeDefaultDescription
companyDbstringRequiredThe company database (schema) to connect to
usernamestringRequiredSAP Business One user code
passwordstringRequiredSAP Business One user password

ConnectionConfig (optional HTTP client configuration, passed as the second argument to new)

FieldTypeDefaultDescription
httpVersionhttp:HttpVersionhttp:HTTP_2_0The HTTP version understood by the client
http1Settingshttp:ClientHttp1Settings{}Configurations related to HTTP/1.x protocol
http2Settingshttp:ClientHttp2Settings{}Configurations related to HTTP/2 protocol
timeoutdecimal30The maximum time to wait (in seconds) for a response before closing the connection
forwardedstring"disable"The choice of setting forwarded/x-forwarded header
followRedirectshttp:FollowRedirects-Configurations associated with Redirection
poolConfighttp:PoolConfiguration-Configurations associated with request pooling
cachehttp:CacheConfig{}HTTP caching related configurations
compressionhttp:Compressionhttp:COMPRESSION_AUTOSpecifies the way of handling compression (accept-encoding) header
circuitBreakerhttp:CircuitBreakerConfig-Configurations associated with the behaviour of the Circuit Breaker
retryConfighttp:RetryConfig-Configurations associated with retrying
cookieConfighttp:CookieConfig-Configurations associated with cookies
responseLimitshttp:ResponseLimitConfigs{}Configurations associated with inbound response size limits
secureSockethttp:ClientSecureSocket-SSL/TLS-related options
proxyhttp:ProxyConfig-Proxy server related options
socketConfighttp:ClientSocketConfig{}Provides settings related to client socket configuration
validationbooleantrueEnables the inbound payload validation functionality provided by the constraint package
laxDataBindingbooleantrueEnables relaxed data binding on the client side

Initializing the client

import ballerinax/sap.businessone;
import ballerinax/sap.businessone.businesspartners;

businesspartners:Client bpClient = check new (
{companyDb: "SBODemoUS", username: "manager", password: "<password>"},
{secureSocket: {enable: false}},
"https://localhost:50000/b1s/v1"
);

Operations

Business Partners

listBusinessPartners

Queries the BusinessPartners collection.

Parameters:

NameTypeRequiredDescription
headersListBusinessPartnersHeadersNoHeaders to be sent with the request (e.g. Prefer for server paging)
queriesListBusinessPartnersQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BusinessPartnersCollectionResponse|error

Sample code:

businesspartners:BusinessPartnersCollectionResponse result = check bpClient->listBusinessPartners(
queries = {dollarSelect: "CardCode,CardName,CardType", dollarTop: 20}
);

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BusinessPartners",
"value": [
{"CardCode": "C20000", "CardName": "Example Customer Ltd", "CardType": "cCustomer"}
],
"odata.nextLink": "BusinessPartners?$skip=20"
}
createBusinessPartners

Creates a new BusinessPartner.

Parameters:

NameTypeRequiredDescription
payloadBusinessPartnerYesThe business partner to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BusinessPartner|error

Sample code:

businesspartners:BusinessPartner created = check bpClient->createBusinessPartners({
CardCode: "C20000",
CardName: "Example Customer Ltd",
CardType: "cCustomer",
GroupCode: 100,
Currency: "USD"
});

Sample response:

{
"CardCode": "C20000",
"CardName": "Example Customer Ltd",
"CardType": "cCustomer",
"GroupCode": 100,
"Currency": "USD",
"Valid": "tYES"
}
getBusinessPartners

Gets a single BusinessPartner by key.

Parameters:

NameTypeRequiredDescription
cardCodestringYesKey property CardCode (Edm.String)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBusinessPartnersQueriesNo$expand and $select query options

Returns: BusinessPartner|error

Sample code:

businesspartners:BusinessPartner bp = check bpClient->getBusinessPartners("C20000",
queries = {dollarSelect: "CardCode,CardName,City,Country"}
);

Sample response:

{
"CardCode": "C20000",
"CardName": "Example Customer Ltd",
"City": "Boston",
"Country": "US"
}
deleteBusinessPartners

Deletes a BusinessPartner.

Parameters:

NameTypeRequiredDescription
cardCodestringYesKey property CardCode (Edm.String)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBusinessPartners("C20000");
updateBusinessPartners

Partially updates a BusinessPartner (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
cardCodestringYesKey property CardCode (Edm.String)
payloadBusinessPartnerYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBusinessPartners("C20000", {Phone1: "+1-555-0199"});
businessPartnersServiceCreateOpenBalance

Creates an opening balance for one or more business partners.

Parameters:

NameTypeRequiredDescription
payloadBusinessPartnersService_CreateOpenBalance_bodyYesOpening balance account and business partner debit/credit lines
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->businessPartnersServiceCreateOpenBalance({
openningBalanceAccount: {openBalanceAccount: "_SYS00000000001", date: "2026-01-01"},
bPCodes: [{code: "C20000", debit: 1000.00d}]
});
businessPartnersServiceInitData

Returns a template BusinessPartner populated with server-side default values, to be used as the basis for a new record.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BusinessPartner|error

Sample code:

businesspartners:BusinessPartner template = check bpClient->businessPartnersServiceInitData();

Sample response:

{
"CardType": "cCustomer",
"VatLiable": "vLiable",
"Valid": "tYES",
"Currency": "##"
}

Contacts

listContacts

Queries the Contacts collection.

Parameters:

NameTypeRequiredDescription
headersListContactsHeadersNoHeaders to be sent with the request
queriesListContactsQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: ContactsCollectionResponse|error

Sample code:

businesspartners:ContactsCollectionResponse result = check bpClient->listContacts(
queries = {dollarFilter: "CardCode eq 'C20000'"}
);

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#Contacts",
"value": [
{"CardCode": "C20000", "ContactCode": 1, "Activity": "cn_Note", "Details": "Follow-up call"}
]
}
createContacts

Creates a new Contact entry (a logged activity/contact note against a business partner).

Parameters:

NameTypeRequiredDescription
payloadContactYesThe contact entry to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: Contact|error

Sample code:

businesspartners:Contact created = check bpClient->createContacts({
CardCode: "C20000",
Activity: "cn_Note",
ContactDate: "2026-07-10",
Details: "Follow-up call regarding open invoice"
});

Sample response:

{
"CardCode": "C20000",
"ContactCode": 5,
"Activity": "cn_Note",
"ContactDate": "2026-07-10",
"Details": "Follow-up call regarding open invoice"
}
getContacts

Gets a single Contact by key.

Parameters:

NameTypeRequiredDescription
contactCodeint:Signed32YesKey property ContactCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetContactsQueriesNo$expand and $select query options

Returns: Contact|error

Sample code:

businesspartners:Contact contact = check bpClient->getContacts(5);

Sample response:

{
"CardCode": "C20000",
"ContactCode": 5,
"Activity": "cn_Note",
"Details": "Follow-up call regarding open invoice"
}
deleteContacts

Deletes a Contact.

Parameters:

NameTypeRequiredDescription
contactCodeint:Signed32YesKey property ContactCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteContacts(5);
updateContacts

Partially updates a Contact (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
contactCodeint:Signed32YesKey property ContactCode (Edm.Int32)
payloadContactYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateContacts(5, {Closed: "tYES"});

Business Partner Groups

listBusinessPartnerGroups

Queries the BusinessPartnerGroups collection.

Parameters:

NameTypeRequiredDescription
headersListBusinessPartnerGroupsHeadersNoHeaders to be sent with the request
queriesListBusinessPartnerGroupsQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BusinessPartnerGroupsCollectionResponse|error

Sample code:

businesspartners:BusinessPartnerGroupsCollectionResponse result = check bpClient->listBusinessPartnerGroups();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BusinessPartnerGroups",
"value": [
{"Code": 100, "Name": "Customers - Domestic", "Type": "bpgt_CustomersGroup"}
]
}
createBusinessPartnerGroups

Creates a new BusinessPartnerGroup.

Parameters:

NameTypeRequiredDescription
payloadBusinessPartnerGroupYesThe group to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BusinessPartnerGroup|error

Sample code:

businesspartners:BusinessPartnerGroup created = check bpClient->createBusinessPartnerGroups({
Name: "Customers - Export",
Type: "bpgt_CustomersGroup"
});

Sample response:

{"Code": 101, "Name": "Customers - Export", "Type": "bpgt_CustomersGroup"}
getBusinessPartnerGroups

Gets a single BusinessPartnerGroup by key.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBusinessPartnerGroupsQueriesNo$expand and $select query options

Returns: BusinessPartnerGroup|error

Sample code:

businesspartners:BusinessPartnerGroup group = check bpClient->getBusinessPartnerGroups(100);

Sample response:

{"Code": 100, "Name": "Customers - Domestic", "Type": "bpgt_CustomersGroup"}
deleteBusinessPartnerGroups

Deletes a BusinessPartnerGroup.

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBusinessPartnerGroups(101);
updateBusinessPartnerGroups

Partially updates a BusinessPartnerGroup (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
codeint:Signed32YesKey property Code (Edm.Int32)
payloadBusinessPartnerGroupYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBusinessPartnerGroups(101, {Name: "Customers - International"});

Business Partner Properties

listBusinessPartnerProperties

Queries the BusinessPartnerProperties collection.

Parameters:

NameTypeRequiredDescription
headersListBusinessPartnerPropertiesHeadersNoHeaders to be sent with the request
queriesListBusinessPartnerPropertiesQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BusinessPartnerPropertiesCollectionResponse|error

Sample code:

businesspartners:BusinessPartnerPropertiesCollectionResponse result = check bpClient->listBusinessPartnerProperties();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BusinessPartnerProperties",
"value": [
{"PropertyCode": 1, "PropertyName": "VIP Customer"}
]
}
createBusinessPartnerProperties

Creates a new BusinessPartnerProperty.

Parameters:

NameTypeRequiredDescription
payloadBusinessPartnerPropertyYesThe property to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BusinessPartnerProperty|error

Sample code:

businesspartners:BusinessPartnerProperty created = check bpClient->createBusinessPartnerProperties({
PropertyName: "Preferred Vendor"
});

Sample response:

{"PropertyCode": 2, "PropertyName": "Preferred Vendor"}
getBusinessPartnerProperties

Gets a single BusinessPartnerProperty by key.

Parameters:

NameTypeRequiredDescription
propertyCodeint:Signed32YesKey property PropertyCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBusinessPartnerPropertiesQueriesNo$expand and $select query options

Returns: BusinessPartnerProperty|error

Sample code:

businesspartners:BusinessPartnerProperty prop = check bpClient->getBusinessPartnerProperties(1);

Sample response:

{"PropertyCode": 1, "PropertyName": "VIP Customer"}
deleteBusinessPartnerProperties

Deletes a BusinessPartnerProperty.

Parameters:

NameTypeRequiredDescription
propertyCodeint:Signed32YesKey property PropertyCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBusinessPartnerProperties(2);
updateBusinessPartnerProperties

Partially updates a BusinessPartnerProperty (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
propertyCodeint:Signed32YesKey property PropertyCode (Edm.Int32)
payloadBusinessPartnerPropertyYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBusinessPartnerProperties(2, {PropertyName: "Preferred Supplier"});
businessPartnerPropertiesServiceGetBusinessPartnerPropertyList

Returns the list of business partner property name/code pairs configured in the company.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: inline_response_200_1|error

Sample code:

businesspartners:inline_response_200_1 result = check bpClient->businessPartnerPropertiesServiceGetBusinessPartnerPropertyList();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BusinessPartnerPropertiesService_GetBusinessPartnerPropertyList",
"value": [
{"PropertyName": "VIP Customer", "PropertyCode": 1}
]
}

Payment Terms Types

listPaymentTermsTypes

Queries the PaymentTermsTypes collection.

Parameters:

NameTypeRequiredDescription
headersListPaymentTermsTypesHeadersNoHeaders to be sent with the request
queriesListPaymentTermsTypesQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: PaymentTermsTypesCollectionResponse|error

Sample code:

businesspartners:PaymentTermsTypesCollectionResponse result = check bpClient->listPaymentTermsTypes();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#PaymentTermsTypes",
"value": [
{"GroupNumber": 3, "PaymentTermsGroupName": "Net 30", "NumberOfAdditionalDays": 30}
]
}
createPaymentTermsTypes

Creates a new PaymentTermsType.

Parameters:

NameTypeRequiredDescription
payloadPaymentTermsTypeYesThe payment terms type to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: PaymentTermsType|error

Sample code:

businesspartners:PaymentTermsType created = check bpClient->createPaymentTermsTypes({
PaymentTermsGroupName: "Net 60",
NumberOfAdditionalDays: 60
});

Sample response:

{"GroupNumber": 4, "PaymentTermsGroupName": "Net 60", "NumberOfAdditionalDays": 60}
getPaymentTermsTypes

Gets a single PaymentTermsType by key.

Parameters:

NameTypeRequiredDescription
groupNumberint:Signed32YesKey property GroupNumber (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetPaymentTermsTypesQueriesNo$expand and $select query options

Returns: PaymentTermsType|error

Sample code:

businesspartners:PaymentTermsType terms = check bpClient->getPaymentTermsTypes(3);

Sample response:

{"GroupNumber": 3, "PaymentTermsGroupName": "Net 30", "NumberOfAdditionalDays": 30}
deletePaymentTermsTypes

Deletes a PaymentTermsType.

Parameters:

NameTypeRequiredDescription
groupNumberint:Signed32YesKey property GroupNumber (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deletePaymentTermsTypes(4);
updatePaymentTermsTypes

Partially updates a PaymentTermsType (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
groupNumberint:Signed32YesKey property GroupNumber (Edm.Int32)
payloadPaymentTermsTypeYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updatePaymentTermsTypes(4, {GeneralDiscount: 5});
paymentTermsTypesClose

Invokes the bound action Close on a PaymentTermsType.

Parameters:

NameTypeRequiredDescription
groupNumberint:Signed32YesKey property GroupNumber (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->paymentTermsTypesClose(4);
paymentTermsTypesServiceUpdateWithBPs

Updates a payment terms type and propagates the change to all business partners assigned to it.

Parameters:

NameTypeRequiredDescription
payloadPaymentTermsTypesService_UpdateWithBPs_bodyYesThe payment terms type to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->paymentTermsTypesServiceUpdateWithBPs({
paymentTermsType: {GroupNumber: 3, PaymentTermsGroupName: "Net 30", NumberOfAdditionalDays: 30}
});

Priorities

listBPPriorities

Queries the BPPriorities collection.

Parameters:

NameTypeRequiredDescription
headersListBPPrioritiesHeadersNoHeaders to be sent with the request
queriesListBPPrioritiesQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BPPrioritiesCollectionResponse|error

Sample code:

businesspartners:BPPrioritiesCollectionResponse result = check bpClient->listBPPriorities();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BPPriorities",
"value": [
{"Priority": 1, "PriorityDescription": "High"}
]
}
createBPPriorities

Creates a new BPPriority.

Parameters:

NameTypeRequiredDescription
payloadBPPriorityYesThe priority to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BPPriority|error

Sample code:

businesspartners:BPPriority created = check bpClient->createBPPriorities({PriorityDescription: "Low"});

Sample response:

{"Priority": 2, "PriorityDescription": "Low"}
getBPPriorities

Gets a single BPPriority by key.

Parameters:

NameTypeRequiredDescription
priorityint:Signed32YesKey property Priority (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBPPrioritiesQueriesNo$expand and $select query options

Returns: BPPriority|error

Sample code:

businesspartners:BPPriority priority = check bpClient->getBPPriorities(1);

Sample response:

{"Priority": 1, "PriorityDescription": "High"}
deleteBPPriorities

Deletes a BPPriority.

Parameters:

NameTypeRequiredDescription
priorityint:Signed32YesKey property Priority (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBPPriorities(2);
updateBPPriorities

Partially updates a BPPriority (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
priorityint:Signed32YesKey property Priority (Edm.Int32)
payloadBPPriorityYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBPPriorities(2, {PriorityDescription: "Low priority"});

VAT Exemptions

listBPVatExemptions

Queries the BPVatExemptions collection.

Parameters:

NameTypeRequiredDescription
headersListBPVatExemptionsHeadersNoHeaders to be sent with the request
queriesListBPVatExemptionsQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BPVatExemptionsCollectionResponse|error

Sample code:

businesspartners:BPVatExemptionsCollectionResponse result = check bpClient->listBPVatExemptions();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BPVatExemptions",
"value": [
{"AbsoluteEntry": 1, "Remarks": "Exempt for export sales", "BPCode": "C20000"}
]
}
createBPVatExemptions

Creates a new BPVatExemptions entry.

Parameters:

NameTypeRequiredDescription
payloadBPVatExemptionsYesThe VAT exemption to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BPVatExemptions|error

Sample code:

businesspartners:BPVatExemptions created = check bpClient->createBPVatExemptions({
bPCode: "C20000",
remarks: "Exempt for export sales"
});

Sample response:

{"AbsoluteEntry": 2, "BPCode": "C20000", "Remarks": "Exempt for export sales"}
getBPVatExemptions

Gets a single BPVatExemptions entry by key.

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBPVatExemptionsQueriesNo$expand and $select query options

Returns: BPVatExemptions|error

Sample code:

businesspartners:BPVatExemptions exemption = check bpClient->getBPVatExemptions(1);

Sample response:

{"AbsoluteEntry": 1, "BPCode": "C20000", "Remarks": "Exempt for export sales"}
deleteBPVatExemptions

Deletes a BPVatExemptions entry.

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBPVatExemptions(2);
updateBPVatExemptions

Partially updates a BPVatExemptions entry (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
absoluteEntryint:Signed32YesKey property AbsoluteEntry (Edm.Int32)
payloadBPVatExemptionsYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBPVatExemptions(2, {remarks: "Updated exemption reason"});
bPVatExemptionsServiceGetList

Returns the list of configured VAT exemption absolute entries and their associated business partner codes.

Parameters:

NameTypeRequiredDescription
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: inline_response_200|error

Sample code:

businesspartners:inline_response_200 result = check bpClient->bPVatExemptionsServiceGetList();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BPVatExemptionsService_GetList",
"value": [
{"AbsoluteEntry": 1, "BPCode": "C20000"}
]
}

Industries

listIndustries

Queries the Industries collection.

Parameters:

NameTypeRequiredDescription
headersListIndustriesHeadersNoHeaders to be sent with the request
queriesListIndustriesQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: IndustriesCollectionResponse|error

Sample code:

businesspartners:IndustriesCollectionResponse result = check bpClient->listIndustries();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#Industries",
"value": [
{"IndustryCode": 1, "IndustryName": "Manufacturing", "IndustryDescription": "Manufacturing sector"}
]
}
createIndustries

Creates a new Industry.

Parameters:

NameTypeRequiredDescription
payloadIndustryYesThe industry to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: Industry|error

Sample code:

businesspartners:Industry created = check bpClient->createIndustries({
IndustryName: "Retail",
IndustryDescription: "Retail sector"
});

Sample response:

{"IndustryCode": 2, "IndustryName": "Retail", "IndustryDescription": "Retail sector"}
getIndustries

Gets a single Industry by key.

Parameters:

NameTypeRequiredDescription
industryCodeint:Signed32YesKey property IndustryCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetIndustriesQueriesNo$expand and $select query options

Returns: Industry|error

Sample code:

businesspartners:Industry industry = check bpClient->getIndustries(1);

Sample response:

{"IndustryCode": 1, "IndustryName": "Manufacturing", "IndustryDescription": "Manufacturing sector"}
deleteIndustries

Deletes an Industry.

Parameters:

NameTypeRequiredDescription
industryCodeint:Signed32YesKey property IndustryCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteIndustries(2);
updateIndustries

Partially updates an Industry (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
industryCodeint:Signed32YesKey property IndustryCode (Edm.Int32)
payloadIndustryYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateIndustries(2, {IndustryDescription: "General retail sector"});

Territories

listTerritories

Queries the Territories collection.

Parameters:

NameTypeRequiredDescription
headersListTerritoriesHeadersNoHeaders to be sent with the request
queriesListTerritoriesQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: TerritoriesCollectionResponse|error

Sample code:

businesspartners:TerritoriesCollectionResponse result = check bpClient->listTerritories();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#Territories",
"value": [
{"TerritoryID": 1, "Description": "Northeast", "Inactive": "tNO"}
]
}
createTerritories

Creates a new Territory.

Parameters:

NameTypeRequiredDescription
payloadTerritoryYesThe territory to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: Territory|error

Sample code:

businesspartners:Territory created = check bpClient->createTerritories({Description: "Southwest"});

Sample response:

{"TerritoryID": 2, "Description": "Southwest", "Inactive": "tNO"}
getTerritories

Gets a single Territory by key.

Parameters:

NameTypeRequiredDescription
territoryIDint:Signed32YesKey property TerritoryID (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetTerritoriesQueriesNo$expand and $select query options

Returns: Territory|error

Sample code:

businesspartners:Territory territory = check bpClient->getTerritories(1);

Sample response:

{"TerritoryID": 1, "Description": "Northeast", "Inactive": "tNO"}
deleteTerritories

Deletes a Territory.

Parameters:

NameTypeRequiredDescription
territoryIDint:Signed32YesKey property TerritoryID (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteTerritories(2);
updateTerritories

Partially updates a Territory (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
territoryIDint:Signed32YesKey property TerritoryID (Edm.Int32)
payloadTerritoryYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateTerritories(2, {Inactive: "tYES"});

Relationships

listRelationships

Queries the Relationships collection.

Parameters:

NameTypeRequiredDescription
headersListRelationshipsHeadersNoHeaders to be sent with the request
queriesListRelationshipsQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: RelationshipsCollectionResponse|error

Sample code:

businesspartners:RelationshipsCollectionResponse result = check bpClient->listRelationships();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#Relationships",
"value": [
{"RelationshipCode": 1, "RelationshipDescription": "Parent Company"}
]
}
createRelationships

Creates a new Relationship.

Parameters:

NameTypeRequiredDescription
payloadRelationshipYesThe relationship to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: Relationship|error

Sample code:

businesspartners:Relationship created = check bpClient->createRelationships({RelationshipDescription: "Subsidiary"});

Sample response:

{"RelationshipCode": 2, "RelationshipDescription": "Subsidiary"}
getRelationships

Gets a single Relationship by key.

Parameters:

NameTypeRequiredDescription
relationshipCodeint:Signed32YesKey property RelationshipCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetRelationshipsQueriesNo$expand and $select query options

Returns: Relationship|error

Sample code:

businesspartners:Relationship relationship = check bpClient->getRelationships(1);

Sample response:

{"RelationshipCode": 1, "RelationshipDescription": "Parent Company"}
deleteRelationships

Deletes a Relationship.

Parameters:

NameTypeRequiredDescription
relationshipCodeint:Signed32YesKey property RelationshipCode (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteRelationships(2);
updateRelationships

Partially updates a Relationship (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
relationshipCodeint:Signed32YesKey property RelationshipCode (Edm.Int32)
payloadRelationshipYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateRelationships(2, {RelationshipDescription: "Wholly-owned subsidiary"});

Fiscal Registry IDs

listBPFiscalRegistryID

Queries the BPFiscalRegistryID collection.

Parameters:

NameTypeRequiredDescription
headersListBPFiscalRegistryIDHeadersNoHeaders to be sent with the request
queriesListBPFiscalRegistryIDQueriesNoOData query options ($skip, $top, $filter, $orderby, $expand, $inlinecount, $select)

Returns: BPFiscalRegistryIDCollectionResponse|error

Sample code:

businesspartners:BPFiscalRegistryIDCollectionResponse result = check bpClient->listBPFiscalRegistryID();

Sample response:

{
"odata.metadata": "https://localhost:50000/b1s/v1/$metadata#BPFiscalRegistryID",
"value": [
{"Numerator": 1, "CNAECode": "6201-5", "Description": "Software development services"}
]
}
createBPFiscalRegistryID

Creates a new BPFiscalRegistryID.

Parameters:

NameTypeRequiredDescription
payloadBPFiscalRegistryIDYesThe fiscal registry ID to create
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: BPFiscalRegistryID|error

Sample code:

businesspartners:BPFiscalRegistryID created = check bpClient->createBPFiscalRegistryID({
CNAECode: "4711-3",
Description: "Retail trade"
});

Sample response:

{"Numerator": 2, "CNAECode": "4711-3", "Description": "Retail trade"}
getBPFiscalRegistryID

Gets a single BPFiscalRegistryID by key.

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request
queriesGetBPFiscalRegistryIDQueriesNo$expand and $select query options

Returns: BPFiscalRegistryID|error

Sample code:

businesspartners:BPFiscalRegistryID registry = check bpClient->getBPFiscalRegistryID(1);

Sample response:

{"Numerator": 1, "CNAECode": "6201-5", "Description": "Software development services"}
deleteBPFiscalRegistryID

Deletes a BPFiscalRegistryID.

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->deleteBPFiscalRegistryID(2);
updateBPFiscalRegistryID

Partially updates a BPFiscalRegistryID (PATCH/MERGE semantics).

Parameters:

NameTypeRequiredDescription
numeratorint:Signed32YesKey property Numerator (Edm.Int32)
payloadBPFiscalRegistryIDYesFields to update
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->updateBPFiscalRegistryID(2, {Description: "General retail trade"});

Opening Balances

bPOpeningBalanceServiceCreateOpenBalance

Creates an opening balance entry directly against one or more business partner codes.

Parameters:

NameTypeRequiredDescription
payloadBPOpeningBalanceService_CreateOpenBalance_bodyYesOpening balance account and business partner debit/credit lines
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: error?

Sample code:

check bpClient->bPOpeningBalanceServiceCreateOpenBalance({
openningBalanceAccount: {openBalanceAccount: "_SYS00000000001", date: "2026-01-01"},
bPCodes: [{code: "C20000", debit: 1000.00d}]
});

Address Services

addressServiceGetAddressFormat

Resolves the address format definition for a given format code/name.

Parameters:

NameTypeRequiredDescription
payloadAddressService_GetAddressFormat_bodyYesThe address format lookup parameters
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: AddressFormat|error

Sample code:

businesspartners:AddressFormat format = check bpClient->addressServiceGetAddressFormat({
addressFormatParams: {code: 1, name: "US Address Format"}
});

Sample response:

{"Code": 1, "Name": "US Address Format", "Format": "%Street%, %City%, %State% %ZipCode%"}
addressServiceGetFullAddress

Resolves the fully formatted, single-line address for a given set of address components.

Parameters:

NameTypeRequiredDescription
payloadAddressService_GetFullAddress_bodyYesThe address components to resolve
headersmap<string|string[]>NoHeaders to be sent with the request

Returns: AddressReturnParams|error

Sample code:

businesspartners:AddressReturnParams fullAddress = check bpClient->addressServiceGetFullAddress({
addressParams: {Street: "Main St", StreetNo: "123", City: "Boston", State: "MA", ZipCode: "02110", Country: "US"}
});

Sample response:

{"FullAddress": "123 Main St, Boston, MA 02110"}

Session

logout

Ends the active SAP Business One Service Layer session.

Parameters:

None

Returns: error?

Sample code:

check bpClient->logout();