Skip to content

Latest commit

 

History

History
197 lines (156 loc) · 5.99 KB

UtilsApi.md

File metadata and controls

197 lines (156 loc) · 5.99 KB

SMSWorks.Api.Api.UtilsApi

All URIs are relative to https://api.thesmsworks.co.uk/v1

Method HTTP request Description
UtilsErrorsErrorcodeGet GET /utils/errors/{errorcode} Get error by code
UtilsTestGet GET /utils/test Return the customer ID to the caller

UtilsErrorsErrorcodeGet

ExtendedErrorModel UtilsErrorsErrorcodeGet (string errorcode)

Get error by code

Returns a sample error object for the given error code. Useful for designing code to react to errors when they occur for real.

Example

using System.Collections.Generic;
using System.Diagnostics;
using SMSWorks.Api.Api;
using SMSWorks.Api.Client;
using SMSWorks.Api.Model;

namespace Example
{
    public class UtilsErrorsErrorcodeGetExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.thesmsworks.co.uk/v1";
            // Configure API key authorization: JWT
            config.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new UtilsApi(config);
            var errorcode = "errorcode_example";  // string | The code of the error you would like returned

            try
            {
                // Get error by code
                ExtendedErrorModel result = apiInstance.UtilsErrorsErrorcodeGet(errorcode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UtilsApi.UtilsErrorsErrorcodeGet: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UtilsErrorsErrorcodeGetWithHttpInfo variant

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

try
{
    // Get error by code
    ApiResponse<ExtendedErrorModel> response = apiInstance.UtilsErrorsErrorcodeGetWithHttpInfo(errorcode);
    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 UtilsApi.UtilsErrorsErrorcodeGetWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
errorcode string The code of the error you would like returned

Return type

ExtendedErrorModel

Authorization

JWT

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

HTTP response details

Status code Description Response headers
0 Error -

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

UtilsTestGet

TestResponse UtilsTestGet ()

Return the customer ID to the caller

A generic test method which can be used to verify that the API is up and that your calls are authenticated successfully

Example

using System.Collections.Generic;
using System.Diagnostics;
using SMSWorks.Api.Api;
using SMSWorks.Api.Client;
using SMSWorks.Api.Model;

namespace Example
{
    public class UtilsTestGetExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.thesmsworks.co.uk/v1";
            // Configure API key authorization: JWT
            config.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new UtilsApi(config);

            try
            {
                // Return the customer ID to the caller
                TestResponse result = apiInstance.UtilsTestGet();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UtilsApi.UtilsTestGet: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UtilsTestGetWithHttpInfo variant

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

try
{
    // Return the customer ID to the caller
    ApiResponse<TestResponse> response = apiInstance.UtilsTestGetWithHttpInfo();
    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 UtilsApi.UtilsTestGetWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

TestResponse

Authorization

JWT

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

HTTP response details

Status code Description Response headers
200 Success -
0 Error -

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