POST /api/businesses

Adds a business organization on the platform.

Authorization Roles/Permissions: Must be logged in. Must be an authorized administrator such as a Site Admin or Business Admin.

This topic includes the following sections:

HTTP Method

POST

Back to top

URL

https://{hostname}/api/businesses

Back to top

Sample Request

The examples below show requests to add a business organization on the platform, at the top level (#1) and at the child level (#2).

Request URL

https://{hostname}/api/businesses

Sample request headers

POST /api/businesses HTTP/1.1
Host: {hostname}
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json
X-Csrf-Token_acmepaymentscorp":"TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body #1

Adds a new business at the top level. Optional avatar not specified.

{
  "BusinessType":"Company",
  "Name":"ACME Payments Corporation",
  "Description":"ACME Payments Corporation",
  "PictureID":""
}

Sample request body #2

Adds a child business, therefore includes ParentBusinessID. Also includes optional avatar.

{
  "BusinessType":"Department",
  "Name":"ACME Payments Corporation Billing Department",
  "Description":"ACME Payments Corporation Billing Department",
  "PictureID":"1001",
  "ParentBusinessID":"9df5ea91-26db-49b9-a4d3-4775a7130158.acmepaymentscorp"
}

Back to top

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept

Any of the following media types is valid for the Accept header:

application/json, application/xml

application/vnd.soa.v71+json, application/vnd.soa.v71+xml

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

application/vnd.soa.v81+json, application/vnd.soa.v81+xml

application/vnd.soa.v83+json or application/vnd.soa.v83+xml

Content-Type

Any one of the following media types is valid for the request Content-Type:

application/json or application/xml

application/vnd.soa.v71+json or application/vnd.soa.v71+xml

application/vnd.soa.v72+json or application/vnd.soa.v72+xml

application/vnd.soa.v80+json or application/vnd.soa.v80+xml

application/vnd.soa.v81+json or application/vnd.soa.v81+xml

application/vnd.soa.v83+json or application/vnd.soa.v83+xml

X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
Business Body Business Required

Contains information about a business on the platform.

Only Name and Description are required. Depending on needs, include additional values:

  • Include BusinessType if you want a value other than Company. See BusinessType values.
  • Include Dropbox PictureID if you are including an avatar for the new business organization.
  • Include ParentBusinessID if you are adding a child business organization.

Note: Unless visibility is specified, the new business has limited visibility.

Back to top

Response

If successful, this operation returns HTTP status code 200, with information about the organization that was added.

Back to top

Sample Response

The sample response below shows successful completion of this operation.

Sample response headers: application/vnd.soa.v83+json

HTTP/1.1 200 OK
Date: Thu, 10 Nov 2016 21:44:02 GMT
Content-Type: application/vnd.soa.v83+json

Sample response body #1: application/vnd.soa.v83+json

Adds a new organization at the top level.

{
  "BusinessID" : "2dd3432d-641d-4e6d-90b9-58acbbf36f7a.acmepaymentscorp",
  "Name" : "ACME Payments Corporation",
  "Description" : "ACME Payments Corporation",
  "Visibility" : "Limited",
  "AdminGroupID" : "bizadmin-2dd3432d-641d-4e6d-90b9-58acbbf36f7a.acmepaymentscorp",
  "BusinessType" : "Company"
}

Sample response body #2: application/vnd.soa.v83+json

Adds a new child organization.

{
  "BusinessID" : "cba4a1b0-47d3-4e04-b84d-8688fba6bd01.acmepaymentscorp",
  "Name" : "ACME Payments Organization Payments Department",
  "Description" : "ACME Payments Organization Payments Department",
  "Visibility" : "Limited",
  "AdminGroupID" : "bizadmin-cba4a1b0-47d3-4e04-b84d-8688fba6bd01.acmepaymentscorp",
  "BusinessType" : "Department",
  "ParentBusinessID" : "fc868639-4d3a-4f19-89c9-edbb95173566.acmepaymentscorp",
  "TargetResources" : {
    "TargetResource" : [ {
      "Name" : "ACME Payments Corporation",
      "ID" : "fc868639-4d3a-4f19-89c9-edbb95173566.acmepaymentscorp",
      "Type" : "business",
      "Avatar" : "http://acmepaymentscorp/api/businesses/fc868639-4d3a-4f19-89c9-edbb95173566
.acmepaymentscorp/avatars/8ae40103-b026-4e95-8974-341f00c63d1f.png"
    } ]
  }
}

Back to top

Sample response headers: application/vnd.soa.v83+xml

HTTP/1.1 200 OK
Date: Thu, 18 Aug 2016 15:36:37 GMT
Content-Type: application/vnd.soa.v83+xml

Sample response body #1: application/vnd.soa.v83+xml

Adds a new organization at the top level.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Business xmlns="http://soa.com/xsd/business/1.0" xmlns:ns2="http://soa.com/xsd/legals/1.0" 
xmlns:ns3="http://soa.com/xsd/dnmodel/1.0" xmlns:ns4="http://soa.com/xsd/api/1.0">
  <BusinessID>266c74a3-821f-4692-bc72-9460a213bbc7.acmepaymentscorp</BusinessID>
  <Name>ACME Payments Corp Investment Division</Name>
  <Description>Financial management service for the engineering industry: investment division.</Description>
  <Visibility>Public</Visibility>
  <AdminGroupID>bizadmin-266c74a3-821f-4692-bc72-9460a213bbc7.acmepaymentscorp</AdminGroupID>
</Business>

Back to top

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type

application/json, application/xml

application/vnd.soa.v71+json, application/vnd.soa.v71+xml

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

application/vnd.soa.v81+json, application/vnd.soa.v81+xml

application/vnd.soa.v83+json or application/vnd.soa.v83+xml

Back to top

Response Body

Name Type Description
Business Business

Contains information about a business on the platform.

When adding a business, Name and Description are required.

Back to top

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
404

The resource could not be found. For example, you might get this if you have a typo in the URL, or if the Content-Type or Accept header is missing or set to a wrong value.

You would also get a 404 if you had an incorrect value for ParentBusinessID in the message body.

500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics