Skip to content

Businesses

Introduction

The Businesses API allows you to create and access information about businesses.

Usage

List

Pagination Enabled

List all Businesses that the user has the authority to see.

Parameters

PropertyTypeRequiredExample
pageNumberNumber1

Usage

const businesses = await Xedi.Businesses.list();

Response

{
"current_page": 1,
"data": [
{
"_id": "c52abc50-b499-11ea-a48c-0100f1a50c6e",
"business_name": "Avengers",
"address_1": "TOP_SECRET",
"address_2": "TOP_SECRET",
"address_3": "New York",
"address_4": null,
"post_code": "TOP_SECRET",
"currency": "usd",
"vat_code": "123",
"invoice_name": "123",
"country_code": "USA",
"contact_name": "Anthony Stark",
"contact_email": "t.stark@avengers.org",
"contact_no": "(970) 517-1743 x67916",
"website": "https://avengers.org",
"logo": "https://assets.avengers.org/images/logo.png",
"requires_gln": false,
"gs1_prefix": "030",
"slug": "avengers",
"external": false,
"public": true
},
{
"_id": "d1dfb302-b53d-11ea-95d2-0100f1a50c6e",
"business_name": "Hydra",
"address_1": "EVERYWHERE",
"address_2": "EVERYWHERE",
"address_3": "EVERYWHERE",
"address_4": null,
"post_code": "EVERYWHERE",
"currency": "usd",
"vat_code": "456",
"invoice_name": "456",
"country_code": "USA",
"contact_name": null,
"contact_email": null,
"contact_no": null,
"website": null,
"logo": null,
"requires_gln": false,
"gs1_prefix": "030",
"slug": "hydra",
"external": false,
"public": false
}
],
"first_page_url": "https://api.xedi.com/1/businesses?page=1",
"from": 1,
"last_page": "https://api.xedi.com/1/businesses?page=1",
"last_page_url": null,
"next_page_url": null,
"path": "https://api.xedi.com/1/businesses",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2
}

Get

Get a Business by ID.

Parameters

PropertyTypeRequiredExample
business_idUUIDc52abc50-b499-11ea-a48c-0100f1a50c6e

Usage

const business = await Xedi.Businsses.get('c52abc50-b499-11ea-a48c-0100f1a50c6e');

Response

{
"_id": "c52abc50-b499-11ea-a48c-0100f1a50c6e",
"business_name": "Avengers",
"address_1": "TOP_SECRET",
"address_2": "TOP_SECRET",
"address_3": "New York",
"address_4": null,
"post_code": "TOP_SECRET",
"currency": "usd",
"vat_code": "123",
"invoice_name": "123",
"country_code": "USA",
"contact_name": "Anthony Stark",
"contact_email": "t.stark@avengers.org",
"contact_no": "(970) 517-1743 x67916",
"website": "https://avengers.org",
"logo": "https://assets.avengers.org/images/logo.png",
"requires_gln": false,
"gs1_prefix": "030",
"slug": "avengers",
"external": false,
"public": true
}

Create

Create a Business.

Parameters

PropertyTypeRequiredExample
business_nameStringMicrosoft
address_1StringMicrosoft Corporation
address_2StringOne Microsoft Way
address_3StringRedmond
address_4StringWA
post_codeString98052-6399
currencyString (ISO-4217)usd
vat_codeString91-1144442
invoice_nameStringMSFT
country_codeString (ISO-3166)USA
contact_nameStringSatya Nadella
contact_emailStrings.nadella@microsoft.com
contact_noString(425) 882-8080
websiteStringhttps://www.microsoft.com
logoStringhttps://assets.microsoft.com/logo.png
requires_glnBooleantrue
gs1_prefixNumber030
slugStringMSFT
externalBooleantrue
publicBooleantrue

Usage

const business = Xedi.Businesses.create({
business_name: "Microsoft",
address_1: "Microsof Corporation",
address_2: "One Microsoft Way",
address_3: "Redmond",
address_4: "WA",
post_code: "98052-6399",
currency: "usd",
vat_code: "91-1144442",
invoice_name: "MSFT",
country_code: "USA",
contact_name: "Satya Nadella",
contact_email: "s.nadella@microsoft.com",
contact_no: "(425) 882-8080",
website: "https://www.microsoft.com",
logo: "https://assets.microsoft.com/logo.png",
requires_gln: false,
gs1_prefix: 030,
slug: "MSFT",
external: false,
public: true,
});

Response

{
"_id": "3f580f3e-b542-11ea-a254-0100f1a50c6e",
"business_name": "Microsoft",
"address_1": "Microsof Corporation",
"address_2": "One Microsoft Way",
"address_3": "Redmond",
"address_4": "WA",
"post_code": "98052-6399",
"currency": "usd",
"vat_code": "91-1144442",
"invoice_name": "MSFT",
"country_code": "USA",
"contact_name": "Satya Nadella",
"contact_email": "s.nadella@microsoft.com",
"contact_no": "(425) 882-8080",
"website": "https://www.microsoft.com",
"logo": "https://assets.microsoft.com/logo.png",
"requires_gln": false,
"gs1_prefix": 030,
"slug": "MSFT",
"external": false,
"public": true,
"created_at": "2020-06-23 12:10:16",
"updated_at": null
}

Get by User

Pagination Enabled

List all the businesses a particular user is associated with.

Parameters

PropertyTypeRequiredExample
user_idUUIDf3ce14b8-b542-11ea-aded-01002da17977
pageNumbernumber1

Usage

const businesses = await Xedi.Businesses.getByUser('f3ce14b8-b542-11ea-aded-01002da17977');

Response

{
"current_page": 1,
"data": [
{
"_id": "c52abc50-b499-11ea-a48c-0100f1a50c6e",
"business_name": "Avengers",
"address_1": "TOP_SECRET",
"address_2": "TOP_SECRET",
"address_3": "New York",
"address_4": null,
"post_code": "TOP_SECRET",
"currency": "usd",
"vat_code": "123",
"invoice_name": "123",
"country_code": "USA",
"contact_name": "Anthony Stark",
"contact_email": "t.stark@avengers.org",
"contact_no": "(970) 517-1743 x67916",
"website": "https://avengers.org",
"logo": "https://assets.avengers.org/images/logo.png",
"requires_gln": false,
"gs1_prefix": "030",
"slug": "avengers",
"external": false,
"public": true
}
],
"first_page_url": "https://api.xedi.com/1/businesses?page=1",
"from": 1,
"last_page": "https://api.xedi.com/1/businesses?page=1",
"last_page_url": null,
"next_page_url": null,
"path": "https://api.xedi.com/1/businesses",
"per_page": 15,
"prev_page_url": null,
"to": 1,
"total": 1
}

Remove User From Business

Remove a user from a business, by deleting their businessUser data

Parameters

PropertyTypeRequiredExample
business_uuidUUIDf3ce14b8-b542-11ea-aded-01002da17977
user_idUUIDc52abc50-b499-11ea-a48c-0100f1a50c6e

Usage

await Xedi.Businesses.removeUserFromBusiness('f3ce14b8-b542-11ea-aded-01002da17977', 'c52abc50-b499-11ea-a48c-0100f1a50c6e');

Response

{
"data": []
}