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. It is possible to invoke the API via HTTP or HTTPS through a certified authentication.

 

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:

 
  1. Base URL: Base URL to the CPBM Server-

    http://<IP of CPBM server>:<port>

  2. Base API Path: Path to the base API Servlet that processes the incoming requests-

    /portal/api

  3. REST API Path: Path to CPBM rest api controller-

    for example, /accounts

  4. 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)

  5. 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.
  6. The final URL:

    http://<IP of CPBM server>:<port>/portal/api/accounts.json?_=<timestamp>&apiKey=<apikey>&signature=<generatedSignatureUsingSecretKey>

 

Before you begin to use the BSS API, you should have:

 
  • 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

  1. Get the API key and Secret key for a user:
    Get these keys by following the steps given below:
    1. Log in to CloudPortal Business Manager.
    2. Click Root user in the top right hand corner of the UI.
    3. Click My Profile > API Credentials.
    4. Enter your password and click Proceed.
    5. Note the API key and Secret key.
  2. Generate the signature:
    1. 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.
    2. Lower case the entire Parameter String and sort it alphabetically via the field for each field-value pair.

      =1368420672402&apikey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq

    3. Prefix the parameter string with the REST API path as shown below:

      /accounts_=1368420672402&apikey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq

    4. Take the prefixed Parameter String and run it through the HMAC SHA-1 hashing algorithm with the user's Secret Key.
    5. The resulting signature: Cxx1DN401BjmXU%2FcaiK8RAPo02xU%3D
  3. Generate the timestamp.
  4. 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

  <root>  <accounts>  <account>  <uuid>9fc7754c-6d46-11e0-a026-065287aed31a</uuid>  <name>SERVICE</name>  <accountId>00000000</accountId>  <state>ACTIVE</state>  <sourceChannel></sourceChannel><accountType>  <id>1</id>  <name>SYSTEM</name>  <displayName>System</displayName>  <description>system account type</description>  </accountType>  <spendLimit>0.0000</spendLimit>  <initialDeposit>0.0000</initialDeposit>  <spendBudget>0.0000</spendBudget>  <owner>  <firstName>ROOT</firstName>  <email>samplename@accelerite.com</email>  <lastName>USER</lastName>  <phone>(000) 000 0000</phone>  <username>root</username>  <uuid>62153c00-6d48-11e0-830c-8bca523c3555</uuid>  <address></address>  <apiKey>hlz8Qvn03gvCy2rcwj5v-w_NPcfcXDe3USOVFRbEvl6-rST_YoIbVkgL9geO6Ykt-csZkIhXTOA6_BxDEX18Tw  </apiKey>  <countryCode></countryCode>  <gravatarUrl></gravatarUrl>  <profile>  <name>Root</name>  <description>Root</description>  </profile>  <enabled>true</enabled>  <secretKey>VXxhHXAhsFY_XBwThUs9CnS7vv5fiFtVfgVMmZq3_h9JTJHoBzEBHzf6v2p14ci5McgKV-vxVLQVQ9F9cTXrGg  </secretKey>  <spendBudget>0.0000</spendBudget>  <title></title>  <timeZone>Pacific/Tongatapu</timeZone>  </owner>  <address><city>Any Town</city>  <country>US</country>  <postalCode>12345</postalCode>  <state>DE</state></address>  <secondaryAddress></secondaryAddress>  <currency>  <currencyCode>USD</currencyCode>  <currencyName>US Dollar</currencyName>  </currency>  <memo></memo>  <trialAccount></trialAccount>  <tenantExtraInformation></tenantExtraInformation>  <deposit></deposit>  <remoteAddress>0.0.0.0</remoteAddress>  <removed></removed>  <removedBy></removedBy>  <imagePath>9fc7754c-6d46-11e0-a026-065287aed31a/images2.jpg</imagePath>  <faviconPath></faviconPath>  <usernameSuffix>root</usernameSuffix>  <users>  <user>  <firstName>ROOT</firstName>  <lastName>USER</lastName>  <username>root</username>  <uuid>62153c00-6d48-11e0-830c-8bca523c3555</uuid>  </user>  <user>  <firstName>PORTAL</firstName>  <lastName>PORTAL</lastName>  <username>portal</username>  <uuid>74ed2fc2-6d48-11e0-830c-8bca523c3555</uuid>  </user>  <user>  <firstName>ops</firstName>  <lastName>admins</lastName>  <username>opsadmin</username>  <uuid>d7f249df-4f1b-4b55-90c7-67f53a2cbd77</uuid>  </user>  <user>  <firstName>Ops</firstName>  <lastName>admin</lastName>  <username>opsMonis</username>  <uuid>ffc61a28-fd57-48bc-82ac-860022eeee2f</uuid>  </user>  <user><firstName>Sales</firstName>  <lastName>Support</lastName>  <username>SSmonis</username>  <uuid>2e61bda6-d2ef-498f-9645-b6d2748d83ff</uuid>  </user>  <user><firstName>Product</firstName>  <lastName>Manager</lastName>  <username>pMMonis</username>  <uuid>29569924-4855-477a-b655-f9b99920aebe</uuid>  </user>  <user>  <firstName>Help</firstName>  <lastName>Desk</lastName>  <username>hdMonis</username>  <uuid>109a9485-34b4-42a5-938c-b42d6dd91458</uuid>  </user>  <user>  <firstName>Finance</firstName>  <lastName>Admin</lastName>  <username>faMonis</username>  <uuid>11c3c10a-0e64-45ad-8147-8b08c8240dab</uuid>  </user>  </users>  </account>  </accounts>  </root>
 
또 다른 질문이 있으십니까? 문의 등록

댓글

 
Adding comment, please wait....

Provide Feedback on Article:

Subject:
Comments:*
Zendesk 제공