Skip to content

Latest commit

 

History

History
202 lines (159 loc) · 6.53 KB

SubaccountApi.md

File metadata and controls

202 lines (159 loc) · 6.53 KB

Org.OpenAPITools.Api.SubaccountApi

All URIs are relative to https://api.vultr.com/v2

Method HTTP request Description
CreateSubaccount POST /subaccounts Create Sub-Account
ListSubaccounts GET /subaccounts List Sub-Accounts

CreateSubaccount

CreateSubaccount201Response CreateSubaccount (CreateSubaccountRequest? createSubaccountRequest = null)

Create Sub-Account

Create a new subaccount.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class CreateSubaccountExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vultr.com/v2";
            // Configure Bearer token for authorization: API Key
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubaccountApi(config);
            var createSubaccountRequest = new CreateSubaccountRequest?(); // CreateSubaccountRequest? | Include a JSON object in the request body with a content type of **application/json**. (optional) 

            try
            {
                // Create Sub-Account
                CreateSubaccount201Response result = apiInstance.CreateSubaccount(createSubaccountRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubaccountApi.CreateSubaccount: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateSubaccountWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Sub-Account
    ApiResponse<CreateSubaccount201Response> response = apiInstance.CreateSubaccountWithHttpInfo(createSubaccountRequest);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubaccountApi.CreateSubaccountWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
createSubaccountRequest CreateSubaccountRequest? Include a JSON object in the request body with a content type of application/json. [optional]

Return type

CreateSubaccount201Response

Authorization

[API Key](../README.md#API Key)

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -
400 Bad Request -
401 Unauthorized -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListSubaccounts

ListSubaccounts200Response ListSubaccounts (int? perPage = null, string? cursor = null)

List Sub-Accounts

Get information about all sub-accounts for your account.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class ListSubaccountsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vultr.com/v2";
            // Configure Bearer token for authorization: API Key
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubaccountApi(config);
            var perPage = 56;  // int? | Number of items requested per page. Default is 100 and Max is 500. (optional) 
            var cursor = "cursor_example";  // string? | Cursor for paging. See [Meta and Pagination](#section/Introduction/Meta-and-Pagination). (optional) 

            try
            {
                // List Sub-Accounts
                ListSubaccounts200Response result = apiInstance.ListSubaccounts(perPage, cursor);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubaccountApi.ListSubaccounts: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ListSubaccountsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // List Sub-Accounts
    ApiResponse<ListSubaccounts200Response> response = apiInstance.ListSubaccountsWithHttpInfo(perPage, cursor);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubaccountApi.ListSubaccountsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
perPage int? Number of items requested per page. Default is 100 and Max is 500. [optional]
cursor string? Cursor for paging. See Meta and Pagination. [optional]

Return type

ListSubaccounts200Response

Authorization

[API Key](../README.md#API Key)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

[Back to top] [Back to API list] [Back to Model list] [Back to README]