Example
The BSS APIs represent the set of business-related services exposed by the CPBM that are used to implement a cloud service. The BSS API provides a ReSTful (Representational State Transfer) web service interface and supports four possible actions (Get, Put, Post, and Delete) on exposed resources and supports responses in either XML or JSON response formats. A resource is an individual data entity with a unique identifier. All the resources support an expanded view and a minimal view of the data structure.
By default, the BSS APIs return JSON. To request a specific format, the API call can be appended with a suffix, currently only .json and .xml, which will return JSON and XML respectively.
When the client sends a request to the server for a particular action, the server performs the action and sends a response in the form of a representation of the specified resource. While it is possible to invoke the API via HTTP or HTTPS, Accelerite recommends you to run the API through HTTPS with mutual certificate-based authentication. This allows the CloudPortal Business Manager to establish a trusted link with the calling portal.
Every API request has the following format: Base URL+Base API Path+ REST API Path+Parameter String+Signature. The following example illustrates the typical values of an API request:
- Base URL: Base URL to the CPBM Server-
http://:
- Base API Path: Path to the base API Servlet that processes the incoming requests-
/portal/api
- REST API Path: Path to CPBM rest api controller-
for example, /accounts
- Parameter String: Includes the Timestamp + API key. Additional parameters depend on the resource requested-
_=1368420672402&apiKey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq
(Timestamp (_) is system current time in milliseconds. By default, timestamp is valid for 5 minutes. This can be configured on a need basis)
- Signature: The signature changes with every request and is generated using a keyed-HMAC method with the secret key, REST API path, and the contents of the parameter string. The secret key is provided as a parameter to the keyed-HMAC method. Generated signature (example)-
Cxx1DN401BjmXU%2FcaiK8RAPo02xU%3D
Note: Refer to Generating the Signature to understand how to generate the signature & link it to the corresponding location. - The final URL:
http://:/portal/api/accounts.json?_=&apiKey=&signature=
- Access to the CloudPortal server that you wish to integrate with.
- Both, the API key and Secret key for a user.
Generating a BSS API request
- Get the API key and Secret key for a user:
Get these keys by following the steps given below:
- Log in to CloudPortal Business Manager.
- Click Root user in the top right hand corner of the UI.
- Click My Profile > API Credentials.
- Enter your password and click Proceed.
- Note the API key and Secret key.
- Generate the signature:
- For each field-value pair (as separated by a '&') in the Parameter String, URL, encode each value so that it can be safely sent via HTTP GET.
- Lower case the entire Parameter String and sort it alphabetically via the field for each field-value pair.
=1368420672402&apikey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq
- Prefix the parameter string with the REST API path as shown below:
/accounts_=1368420672402&apikey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq
- Take the prefixed Parameter String and run it through the HMAC SHA-1 hashing algorithm with the user's Secret Key.
- The resulting signature: Cxx1DN401BjmXU%2FcaiK8RAPo02xU%3D
- Generate the timestamp.
- Construct the final URL: Base URL+Base API Path+ REST API Path+Parameter String+Signature
http://localhost:8080/portal/api/accounts?_=1368420672402&apiKey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq&signature=Cxx1DN401BjmXU%2FcaiK8RAPo02xU%3D
Sample JSON response:
{ "accounts":[ { "uuid":"9fc7754c-6d46-11e0-a026-065287aed31a", "name":"SERVICE", "accountId":"00000000", "state":"ACTIVE", "sourceChannel":null, "accountType":{ "id":"1", "name":"SYSTEM", "displayName":"System", "description":"system account type" }, "spendLimit":0, "initialDeposit":0, "spendBudget":0, "owner":{ "firstName":"ROOT", "email":"samplename@accelerite.com", "lastName":"USER", "phone":"(000) 000 0000", "username":"root", "uuid":"62153c00-6d48-11e0-830c-8bca523c3555", "address":null, "apiKey":"hlz8Qvn03gvCy2rcwj5v-w_NPcfcXDe3USOVFRbEvl6- rST_YoIbVkgL9geO6Ykt-csZkIhXTOA6_BxDEX18Tw", "countryCode":"", "gravatarUrl":null, "profile":{ "name":"Root", "description":"Root" }, "enabled":true, "secretKey":"VXxhHXAhsFY_XBwThUs9CnS7vv5fiFtVfgVMmZq3_h9JTJHoBzEBHzf6v2p14ci5McgKV -vxVLQVQ9F9cTXrGg", "spendBudget":0, "title":null, "timeZone":"Pacific/Tongatapu" }, "address":{ "city":"Any Town", "country":"US", "postalCode":"12345", "state":"DE" }, "secondaryAddress":null, "currency":{ "currencyCode":"USD", "currencyName":"US Dollar" }, "memo":null, "trialAccount":null, "tenantExtraInformation":null, "deposit":null, "remoteAddress":"0.0.0.0", "removed":null, "removedBy":null, "imagePath":"9fc7754c-6d46-11e0-a026-065287aed31a/images2.jpg", "faviconPath":null, "usernameSuffix":"root", "users":[ { "firstName":"ROOT", "lastName":"USER", "username":"root", "uuid":"62153c00-6d48-11e0-830c-8bca523c3555" }, { "firstName":"PORTAL", "lastName":"PORTAL", "username":"portal", "uuid":"74ed2fc2-6d48-11e0-830c-8bca523c3555" }, { "firstName":"ops", "lastName":"admins", "username":"opsadmin", "uuid":"d7f249df-4f1b-4b55-90c7-67f53a2cbd77" }, { "firstName":"Ops", "lastName":"admin", "username":"opsMonis", "uuid":"ffc61a28-fd57-48bc-82ac-860022eeee2f" }, { "firstName":"Sales", "lastName":"Support", "username":"SSmonis", "uuid":"2e61bda6-d2ef-498f-9645-b6d2748d83ff" }, { "firstName":"Product", "lastName":"Manager", "username":"pMMonis", "uuid":"29569924-4855-477a-b655-f9b99920aebe" }, { "firstName":"Help", "lastName":"Desk", "username":"hdMonis", "uuid":"109a9485-34b4-42a5-938c-b42d6dd91458" }, { "firstName":"Finance", "lastName":"Admin", "username":"faMonis", "uuid":"11c3c10a-0e64-45ad-8147-8b08c8240dab" }, { "firstName":"Palanivel Rajan", "lastName":"RK", "username":"pal_ops", "uuid":"8ad7e3b9-d4df-42a0-98ae-fb6b07c0f6d0" }, { "firstName":"ops", "lastName":"admin", "username":"ops001", "uuid":"91282e5a-4275-4aeb-afc1-e2a988b1792e" } ] }
Sample XML response
9fc7754c-6d46-11e0-a026-065287aed31a SERVICE 00000000 ACTIVE 1 SYSTEM System system account type 0.0000 0.0000 0.0000 ROOT samplename@accelerite.com USER (000) 000 0000 root 62153c00-6d48-11e0-830c-8bca523c3555
hlz8Qvn03gvCy2rcwj5v-w_NPcfcXDe3USOVFRbEvl6-rST_YoIbVkgL9geO6Ykt-csZkIhXTOA6_BxDEX18Tw Root Root true VXxhHXAhsFY_XBwThUs9CnS7vv5fiFtVfgVMmZq3_h9JTJHoBzEBHzf6v2p14ci5McgKV-vxVLQVQ9F9cTXrGg 0.0000 Pacific/TongatapuAny Town US 12345 DE
USD US Dollar 0.0.0.0 9fc7754c-6d46-11e0-a026-065287aed31a/images2.jpg root ROOT USER root 62153c00-6d48-11e0-830c-8bca523c3555 PORTAL PORTAL portal 74ed2fc2-6d48-11e0-830c-8bca523c3555 ops admins opsadmin d7f249df-4f1b-4b55-90c7-67f53a2cbd77 Ops admin opsMonis ffc61a28-fd57-48bc-82ac-860022eeee2f Sales Support SSmonis 2e61bda6-d2ef-498f-9645-b6d2748d83ff Product Manager pMMonis 29569924-4855-477a-b655-f9b99920aebe Help Desk hdMonis 109a9485-34b4-42a5-938c-b42d6dd91458 Finance Admin faMonis 11c3c10a-0e64-45ad-8147-8b08c8240dab
Comments