Question

Add and access organization address, phone number, and email address via API

  • 4 February 2023
  • 2 replies
  • 46 views

Userlevel 7
Badge +19
  • Sr. Karbon Community Guide
  • 1114 replies

When requesting an organization by key, I don’t see where the phone numbers, email addresses, and addresses are listed.

I checked the docs and there’s no information about what I can “$expand”.

Here’s what I see in Karbon:

Here’s the request I made:

url = "https://api.karbonhq.com/v3/Organizations/xxxxxxxxxx?$expand=Contacts"

payload={}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Here’s the resulting code form an API request:

{
"@odata.context": "https://api.karbonhq.com/v3/$metadata#Organizations/KarbonService.OrganizationDTO(Contacts())/$entity",
"@odata.type": "#KarbonService.OrganizationDTO",
"OrganizationKey": "xxxxxxxxxx",
"FullName": "test full name",
"ClientOwner": null,
"ClientManager": null,
"ContactType": null,
"UserDefinedIdentifier": null,
"RestrictionLevel": "Public",
"LastModifiedDateTime": "2023-02-04T15:57:57Z",
"EntityDescription": {
"Text": "abc123"
},
"AccountingDetail": {
"ContactPermaKey": null,
"OrganizationPermaKey": "xxxxxxxxxx",
"BirthDate": null,
"DeathDate": null,
"Salutation": null,
"Sex": null,
"FinancialYearEndDay": null,
"FinancialYearEndMonth": null,
"IncorporationDate": null,
"IncorporationState": null,
"LegalName": null,
"LineOfBusiness": null,
"EntityType": null,
"TaxCountryCode": "US",
"TradingName": null,
"AnnualRevenue": null,
"BaseCurrency": null,
"GstBasis": null,
"GstPeriod": null,
"IncomeTaxInstallmentPeriod": null,
"IsVATRegistered": null,
"OrganizationValuation": null,
"PaysTax": null,
"PrepareGST": null,
"ProvisionalTaxBasis": null,
"ProvisionalTaxRatio": null,
"RevenueModel": null,
"SalesTaxBasis": null,
"SalesTaxPeriod": null,
"Sells": null,
"RegistrationNumbers": [],
"Notes": []
},
"Contacts": []
}

cc: @StuartK (FYI, feel free to leave this to the community 😉)


2 replies

Userlevel 7
Badge +19

I tried stealing some of the language from the webapp API and got this response:

 

Userlevel 3
Badge +2

This is an older thread - but just incase anyone sees this and wonders what the answer is - the Organizations API and Contacts API can be called with queryString $expand=BusinessCards, e.g.
https://api.karbonhq.com/v3/Contacts/{ContactKey}?$expand=BusinessCards

For an Organization there will be a BusinessCards array containing a single business card - which will contain all of the Phone Numbers, Addresses and Email Addresses.
Contacts also have a BusinessCards array, but there may be multiple business cards, each of which could be connected to an Organization via an OrganizationKey.

In addition to this, each BusinessCard will contain a BusinessCardKey that can be used with the /v3/BusinessCards endpoint to retrieve and/or update a specific BusinessCard.

When using PUT to update an Organization, Contact or BusinessCard, be sure to include all of the data you retrieved with a GET as any missing properties will be removed from the record.

Reply