CoreStack offers wide range of REST APIs to integrate with other external services/tools programmatically. With REST API support, it is possible to integrate with almost all of the programming languages while the integration varies from one language to the other.
CoreStack API guide, not only provides the information about the REST APIs available in cURL format, but also provides the code snippets for widely used programming languages in the market such as Java, Python, Javascript, PHP and so on.
Before we get to know about the APIs, it is important to understand some key fundamentals.
CoreStack out of the box supports multi-tenancy. In enterprises and IT organizations, there will be multiple departments. Associates & resources under each department are to be isolated from each other. The isolation is not only needed for financial accounting but also for security and management. Though the associates can have access to multiple departments, but their permissions will vary between departments.
In an enterprise, there can be multiple departments such as Operation, Finance, R&D and these can be considered as tenants in CoreStack. Below diagram shows the sample mapping for a similar setup:
In an IT organization, there can be multiple teams such as QA, Engineering, DevOps and these can be considered as tenants in CoreStack. Below diagram shows the sample mapping for a similar setup:
For detailed information about Accounts, Tenants, Users & Roles, please refer our user guide.
In order to access CoreStack APIs, user must have Access Key & Secret Key. Follow the steps provided below to generate Access Key & Secret Key:
1) Login to CoreStack as ops_admin 2) Navigate to Users Page a. Click the settings icon at the top right b. Click Users from the menu C. Users page will be displayed with the list of users available under the CoreStack Account 3) Click ‘+‘ icon to add a new user 4) Fill in the necessary details and provide a valid Email address 5) Select the checkbox “Generate API Access” at the bottom right 6) Click “Create User” 7) The user will receive an email with the API Endpoint, Access Key & Secret Key
Perform the following steps to regenerate access key & secret key:
1) Login in to CoreStack as the user that has the privilege to manage users (e.g., ops_admin) 2) Navigate to Users Page a. Click the settings icon at the top right b. Click Users from the menu c. Users page will be displayed with the list of users available under the CoreStack Account 3) Select the user for whom the API keys need to be regenerated 4) Expand the section “API Access” on the right pane 5) This section will have the Access Key and Valid Till information along with a “REGENERATE KEY” button 6) Clicking on “REGENERATE KEY” button will overwrite the existing key and creates a new key. The old keys will become invalid after regenerating the keys. 7) The user will receive an email with the regenerated Access Key & Secret Key.
Following are the REST API HTTP Verbs supported by CoreStack
Following are the expected response codes as part of the API response to describe the result of an API operation
CoreStack supports widely used data types as part of the URL query parameters and request/response body.
Pagination applies to only LIST actions such as ListTenants, ListUsers and so on.
Limit in query param is used to limit the number of records in the response whereas page in query parameter is used to provide page number
URL: http://<list_api_endpoint>?limit=25&page=2
1) CloudAccount API actions for Azure
CoreStack requires Username & Auth token to be passed in all API headers. While username remains constant for a user, Auth token must be generated and provided.
Following API is used to generate Auth Token. All other CoreStack API calls require Username, Auth-token & Tenant ID. Few API calls require Account ID. All these values are available in authentication API response.
Auth token is used for authorization. A CoreStack account can have multiple tenants, hence providing tenant ID is mandatory to perform API operations under the corresponding tenant.
Refer below link for the detailed information about Authentication API
Authentication
Following are the headers expected to be available as part of all API requests.
Note: X-Auth-User & X-Auth-Token are required for all API operations except the Authentication API
The following example demonstrates how to use Authentication headers and retrieve the list of all tenants within a CoreStack Account.
cURL Reference: curl -X GET -H “X-Auth-Token: [[apiKey]]” -H “X-Auth-User: [[username]]” URL: https://cloud.corestack.io/v1/tenants
Sample Request: curl -X GET -H “X-Auth-Token: abcedefghijklmno34567890” -H “X-Auth-User: cs_user” URL: https://cloud.corestack.io/v1/tenants
For more details, click here