Add() [OrganizationManager]
Create a new organization
Description
The Add() method is used to create a new organization.
Package Details
Interface
IOrganizationManager
Syntax
await OrganizationManager.Add(Organization organization)
Returns
Task<Organization>
API
POST
/api/v1/organizations
Parameters
Parameter | Description | Parameter Type |
---|---|---|
organization | Organization to be created | Request body |
Sample request body
{
"SourceId": 0,
"SourceReference": "string",
"BusinessSystemType": "Undefined",
"EnglishName": "string",
"FrenchName": "string",
"OrganizationType": "Manufacturer",
"BusinessNumber": "string",
"Id": 0,
"Phones": [
{
"Id": 0,
"LocalNumber": "string",
"AreaCode": "string",
"CountryCode": "string",
"ExtensionNumber": "string",
"InternationalAccessNumber": "string",
"InternationalNumber": "string",
"LocationType": "Business",
"IsPrimary": true,
"PhoneType": "Landline",
"DisplayPhoneNumber": "string"
}
],
"Emails": [
{
"Id": 0,
"LocationType": "Business",
"IsPrimary": true,
"EmailAddress": "string"
}
],
"Addresses": [
{
"Id": 0,
"LocationType": "Business",
"IsPrimary": true,
"CoordinateType": "Mail",
"SubAddressType": "string",
"FloorSectionNumber": "string",
"SuiteApartmentNumber": "string",
"StreetCivicNumber": "string",
"StreetName": "string",
"PostalZipCode": "string",
"BuildingName": "string",
"StreetDirection": "None",
"StreetType": "None",
"CountryCode": 0,
"CountrySubdivisionCode": "string",
"DeliveryInstallationArea": "string",
"DeliveryInstallQualifier": "string",
"GenDeliveryCategory": "string",
"RouteServiceType": "string",
"BoxNumber": "string",
"RouteServiceNumber": "string",
"UnregisteredCityTownName": "string",
"DeliveryDirective": "string",
"GeneratedStreetAddress": "string",
"CityTown": "string",
"CityTownName": "string"
}
]
}
Returns
On success, 200 Ok
On error, 400 Bad Request
On authorization error, 403 Forbidden
Example
var organization = new Organization
{
OrganizationType = OrganizationType.Manufacturer,
FrenchName = "ACME Corporation",
EnglishName = "ACME Corporation",
BusinessNumber = "999"
};
var phoneCoordinate = new PhoneCoordinate
{
LocalNumber = Rand.Next(2000000, 9999999).ToString("D7"),
AreaCode = "613",
CountryCode = "1",
IsPrimary = true,
PhoneType = PhoneType.Landline,
LocationType = CoordinateLocationType.Business
};
var emailCoordinate = new EmailCoordinate
{
LocationType = CoordinateLocationType.Business,
IsPrimary = true,
EmailAddress = "domain@domain.com"
};
organization.Coordinates.Add(phoneCoordinate);
organization.Coordinates.Add(emailCoordinate);
await _organizationManager.Add(organization);