### GET Request Example for Subscription Usage Costs Source: https://apidocs.crayon.com/scenarios/usagecostsbysubscription-get This example demonstrates how to make a GET request to retrieve usage costs for a subscription. It includes the necessary endpoint, headers like Accept, Content-Type, and Authorization. ```http GET "https://api.crayon.com/api/v1/usagecost/resellerCustomer/{resellerCustomerId}/subscription/{subscriptionId}/currency/{currencyCode}/?from={date}&to={date}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Azure Usage API Request Example Source: https://apidocs.crayon.com/scenarios/azureusage-get An example of an HTTP GET request to the Azure Usage API. This includes the request URI, and required headers such as Accept, Content-Type, and Authorization. ```http GET $"https://api.crayon.com/api/v1/AzureUsage/{azurePlanId}/azureSubscriptions/{id}/monthlyUsage?year={year}&month={month}&includeBom={includeBom}" Accept: application/json Content-Type: application/json Authorization: Bearer < Token > ``` -------------------------------- ### Request GET Subscriptions API Example Source: https://apidocs.crayon.com/scenarios/subscriptions-get This example shows the HTTP GET request syntax for retrieving subscriptions. It includes query parameters for filtering by organization ID, publisher customer ID, search terms, and pagination. The example also specifies required headers like Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/subscriptions/?organizationId={organizationId}&publisherCustomerId={publisherCustomerId}&search={search}&page={page}&pageSize={pageSize}&sync={source}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Agreement Products via HTTP POST Request Example Source: https://apidocs.crayon.com/_sources/scenarios/agreementproducts-get Illustrates an example HTTP POST request to retrieve agreement products. It includes setting the Authorization, Accept, and Content-Type headers, and specifies the request URI and body format. ```http POST $"https://api.crayon.com/api/v1/agreementproducts/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### GET Request Example for Customer Tenants Source: https://apidocs.crayon.com/_sources/scenarios/customertenants-get This example demonstrates how to make a GET request to the customer tenants API endpoint. It includes essential headers like Accept, Content-Type, and Authorization. The URL includes parameters for organization ID, search query, pagination, and page size. ```http GET $'/api/v1/customertenants/?organizationId={organizationId}&search={search}&page={page}&pageSize={pageSize}' Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get reseller sales prices HTTP Request Example Source: https://apidocs.crayon.com/scenarios/reseller-sales-prices-get This example shows the HTTP GET request to retrieve reseller sales prices. It includes the request URI with query parameters and the required headers for authorization and content type. ```http GET $"https://api.crayon.com/api/v1/resellersalesprices/?resellerSalesPriceType={resellerSalesPriceType}&objectId={objectId}&resellerSalesPriceObjectType={resellerSalesPriceObjectType}&fromDate={fromDate}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Publishers HTTP Request Example Source: https://apidocs.crayon.com/scenarios/publishers-get This example shows the HTTP GET request syntax to retrieve publishers, including query parameters for filtering and pagination. It also specifies the required request headers: Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/publishers/?names={names}&search={search}&page={page}&pageSize={pageSize}&programType={programType}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Example GET Request for Reseller Sales Prices Source: https://apidocs.crayon.com/_sources/scenarios/reseller-sales-prices-get This example demonstrates how to construct a GET request to retrieve reseller sales prices. It includes necessary query parameters and headers such as Accept, Content-Type, and Authorization. ```http GET "https://api.crayon.com/api/v1/resellersalesprices/?resellerSalesPriceType={resellerSalesPriceType}&objectId={objectId}&resellerSalesPriceObjectType={resellerSalesPriceObjectType}&fromDate={fromDate}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### GET Request Example for Customer Tenants Source: https://apidocs.crayon.com/scenarios/customertenants-get This example shows the structure of an HTTP GET request to retrieve customer tenants. It specifies the request URI with query parameters for filtering and pagination, along with necessary headers like Authorization, Accept, and Content-Type. ```http GET $"/api/v1/customertenants/?organizationId={organizationId}&search={search}&page={page}&pageSize={pageSize} Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Clients HTTP Request Example Source: https://apidocs.crayon.com/scenarios/clients-get This example illustrates an HTTP GET request to the Crayon API's clients endpoint. It specifies query parameters for searching, pagination, and required headers for authorization and content type. ```http GET $"https://api.crayon.com/api/v1/clients/?search={search}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Consumers API Request Example Source: https://apidocs.crayon.com/_sources/scenarios/consumers-get This is an example of an HTTP GET request to retrieve consumers. It specifies query parameters for filtering and pagination, along with required headers for authorization and content type. The response is expected in JSON format. ```http GET $"https://api.crayon.com/api/v1/consumers/?search={search}&organizationId={organizationId}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Client Request Example (HTTP) Source: https://apidocs.crayon.com/scenarios/client-get Demonstrates the HTTP GET request to retrieve a specific client by its ID. It includes necessary headers like Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/clients/{clientId}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Request management links using HTTP GET Source: https://apidocs.crayon.com/scenarios/managementlinks-get This example shows the structure of an HTTP GET request to retrieve management links. It includes query parameters for filtering by customer and subscription IDs, along with pagination options. The example also specifies required headers such as Authorization, Accept, and Content-Type. ```http GET $"/api/v1/managementlinks/?resellerCustomerIds={resellerCustomerIds}&subscriptionIds={subscriptionIds}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get User by ID HTTP Request Example Source: https://apidocs.crayon.com/scenarios/user-get-by-id This example illustrates the HTTP GET request to retrieve a user by ID from the Crayon API. It specifies the request URI, required headers (Authorization, Accept, Content-Type), and an example of how to format the request. ```http GET $"https://api.crayon.com/api/v1/users/{id}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### POST CustomerTenant API Request Example Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create Example of an HTTP POST request to create a customer tenant. It includes the endpoint URL and required headers such as Accept, Content-Type, and Authorization. ```http POST "https://api.crayon.com/api/v1/customertenants/" Accept: application/json Content-Type: application/json Authorization: Bearer < Token > ``` -------------------------------- ### Get Addresses Request Example (HTTP) Source: https://apidocs.crayon.com/scenarios/addresses-get An example of an HTTP GET request to retrieve addresses. Specifies the endpoint, organization ID, address type, and required headers like Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/organizations/{organizationId}/addresses/?type={type}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### POST /api/v1/customertenants/ Source: https://apidocs.crayon.com/scenarios/customertenant-create Creates a new customertenant with detailed profile, company, and optional user information. ```APIDOC ## POST /api/v1/customertenants/ ### Description Creates a new customer tenant with the provided details. ### Method POST ### Endpoint https://api.crayon.com/api/v1/customertenants/ ### Parameters #### Request Body - **customertenant** (CustomerTenantDetailed) - Required - The customer tenant to create. - **Tenant** (CustomerTenant) - Required - **Id** (int) - Optional - **Name** (string) - Required - **Publisher** (ObjectReference) - Required - **Id** (string) - Required - **Name** (string) - Optional - **PublisherCustomerId** (string) - Optional - **ExternalPublisherCustomerId** (string) - Optional - **DomainPrefix** (string) - Required - **Reference** (string) - Optional - **Organization** (Organization) - Required - **InvoiceProfile** (ObjectReference) - Required - **CustomerTenantType** (CustomerTenantType) - Required - **EntityStatus** (EntityStatus) - Optional - **Profile** (CustomerTenantProfile) - Required - **Address** (CustomerTenantAddress) - Required - **AddressLine1** (string) - Required - **AddressLine2** (string) - Optional - **AddressLine3** (string) - Optional - **City** (string) - Required - **CountryCode** (string) - Required - **CountryName** (string) - Optional - **FirstName** (string) - Required - **LastName** (string) - Required - **PostalCode** (string) - Required - **Region** (string) - Required - **Contact** (CustomerTenantContact) - Required - **Email** (string) - Required - **FirstName** (string) - Required - **LastName** (string) - Required - **PhoneNumber** (string) - Required - **CultureCode** (string) - Optional - **LanguageCode** (string) - Optional - **Company** (CustomerTenantCompany) - Required - **OrganizationRegistrationNumber** (string) - Required - **User** (CustomerTenantUser) - Optional - **UserName** (string) - Optional - **Password** (string) - Optional ### Request Headers - **Authorization** (string) - Required - The authorization token in the form Bearer . - **Accept** (string) - Specifies the request and response type, “application/json”. - **Content-Type** (string) - Specifies the media type of the resource, “application/json”. ### Request Example ```json { "Tenant": { "Name": "My customer AB", "Publisher": { "Id": 2 }, "DomainPrefix": "mycustomerprefix", "CustomerTenantType": 2, "Organization": { "Id": 1 }, "InvoiceProfile": { "Id": 7 } }, "Profile": { "Contact": { "FirstName": "Firstname", "LastName": "Lastname", "Email": "firstname.lastname@email.com", "PhoneNumber": "000-12345689" }, "Address": { "FirstName": "Firstname", "LastName": "Lastname", "AddressLine1": "Streetaddress 4", "City": "City", "Region": "Region", "PostalCode": "123456", "CountryCode": "US" } }, "Company": { "OrganizationRegistrationNumber": "12345678" } } ``` ### Response #### Success Response (200) - **Id** (int) - The ID of the newly created customer tenant. - **Name** (string) - The name of the customer tenant. #### Response Example ```json { "Id": 123, "Name": "My customer AB" } ``` ``` -------------------------------- ### CustomerTenantDetailed JSON Example Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create An example JSON structure for a detailed customer tenant resource. This represents the response body for successful customer tenant creation or retrieval operations. ```json { "LastName": "string", "PostalCode": "string", "Region": "string", "Email": "string", "FirstName": "string", "PhoneNumber": "string", "OrganizationRegistrationNumber": "string", "UserName": "string", "Password": "string" } ``` -------------------------------- ### Get Coterminosity Dates API Request Example Source: https://apidocs.crayon.com/scenarios/subscriptions-coterminosity This is an example of a GET request to the Crayon API to retrieve coterminosity dates. It requires organizationId, customerTenantId, and termDuration as parameters. SubscriptionId is optional for specific scenarios. ```HTTP GET https://api.crayon.com/api/v2/subscriptions/coterminosity?organizationId={organizationId} &customerTenantId={customerTenantId}&subscriptionId={subscriptionId}&termDuration={termDuration} ``` -------------------------------- ### Get Organizations HTTP Request Example Source: https://apidocs.crayon.com/scenarios/organizations-get An example of an HTTP GET request to retrieve organizations. It specifies the URI with optional search and pagination parameters, and required headers for content type and authorization. ```http GET $"https://api.crayon.com/api/v1/organizations/?search={search}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### POST /api/v1/customertenants/ Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create Creates a new customer tenant. The request body should contain the necessary details for the customer tenant, and upon success, the created tenant is returned. ```APIDOC ## POST /api/v1/customertenants/ ### Description Creates a new customer tenant. The request body should contain the necessary details for the customer tenant, and upon success, the created tenant is returned. ### Method POST ### Endpoint /api/v1/customertenants/ ### Parameters #### Request Body - **LastName** (string) - Yes - Last name of the customer. - **PostalCode** (string) - Yes - Postal code of the customer's address. - **Region** (string) - Yes - Region of the customer's address. - **Email** (string) - Yes - Email address of the customer contact. - **FirstName** (string) - Yes - First name of the customer contact. - **LastName** (string) - Yes - Last name of the customer contact. - **PhoneNumber** (string) - Yes - Phone number of the customer contact. - **OrganizationRegistrationNumber** (string) - Yes - Registration number of the customer's organization. - **UserName** (string) - No - Username for the customer tenant user. - **Password** (string) - No - Password for the customer tenant user. ### Request Example ```json { "LastName": "Doe", "PostalCode": "90210", "Region": "CA", "Email": "john.doe@example.com", "FirstName": "John", "PhoneNumber": "123-456-7890", "OrganizationRegistrationNumber": "ORG12345", "UserName": "johndoe", "Password": "securepassword" } ``` ### Response #### Success Response (200 or 201) - **CustomerTenantDetailed** - The created customer tenant resource. #### Response Example ```json { "id": "cust-tenant-123", "LastName": "Doe", "PostalCode": "90210", "Region": "CA", "Email": "john.doe@example.com", "FirstName": "John", "PhoneNumber": "123-456-7890", "OrganizationRegistrationNumber": "ORG12345", "UserName": "johndoe", "createdAt": "2023-10-27T10:00:00Z" } ``` ### Request Headers - **Authorization** (string) - Required. The authorization token in the form Bearer . - **Accept** (string) - Specifies the request and response type, "application/json". - **Content-Type** (string) - Specifies the media type of the resource, "application/json". ``` -------------------------------- ### Create User with C# Source: https://apidocs.crayon.com/_sources/scenarios/user-create This C# code demonstrates how to create a new user by instantiating UserUpsert, setting user properties, obtaining a client token, and then calling the Users.Create method. It also shows how to set the user's password upon successful creation. Dependencies include the CrayonApiClient library. ```csharp var user = new UserUpsert { UserName = "myuser@company.com", FirstName = "Firstname", LastName = "LastName", TenantAdmin = true // set true if you are creating a tenant administrator, otherwise not necessary to set }; var client = new CrayonApiClient("http://v1.api.crayon.as/"); var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken; var createUserResponse = client.Users.Create(token, user); if (createUserResponse.IsSuccessStatusCode) { // To set the password var userId = createUserResponse.GetData().Id; client.Users.ChangePassword(token, userId, "newpassword"); } ``` -------------------------------- ### Get Asset Request Example (HTTP) Source: https://apidocs.crayon.com/scenarios/asset-get This example illustrates an HTTP GET request to retrieve an asset by its ID. It specifies the request method, URI, and required headers including Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/assets/{id}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Crayon API POST Request Example Source: https://apidocs.crayon.com/scenarios/customertenant-create Example of a POST request to the Crayon API to create a customer tenant. This includes the endpoint URL and required headers such as Authorization, Accept, and Content-Type. ```http POST $https://api.crayon.com/api/v1/customertenants/Accept: application/json Content-Type: application/json Authorization: Bearer < Token > ``` -------------------------------- ### Get Organization Request Example Source: https://apidocs.crayon.com/scenarios/organization-get Demonstrates the HTTP GET request to retrieve an organization by its ID. It specifies the request URI, required headers such as Authorization, Accept, and Content-Type, and includes an example of how to format the request. ```http GET $"https://api.crayon.com/api/v1/organizations/{id}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### C# Create Customer Tenant Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create This C# code snippet demonstrates how to create a new customer tenant. It involves instantiating CustomerTenantDetailed with necessary tenant, profile, and company information, obtaining an API token, and then calling the CustomerTenants.Create() method. Dependencies include the CrayonApiClient library and authentication credentials. ```csharp var customerTenantDetailed = new CustomerTenantDetailed { Tenant = new CustomerTenant { CustomerTenantType = 2, DomainPrefix = "mycustomer", InvoiceProfile = new ObjectReference { Id = }, Name = "My customer AB", Organization = new Organization { Id = }, Publisher = new ObjectReference { Id = } }, Profile = new CustomerTenantProfile { Address = new CustomerTenantAddress { FirstName = "firstname", LastName = "lastname", AddressLine1 = "addressline 1", City = "city", Region = "state", CountryCode = "SE", PostalCode = "181 61" }, Contact = new CustomerTenantContact { FirstName = "firstname", LastName = "lastname", Email = "firstname.lastname@email.com", PhoneNumber = "000-12345689" } }, Company = new CustomerTenantCompany { OrganizationRegistrationNumber = "12345678" } }; var client = new CrayonApiClient("https://api.crayon.com/"); var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken; var result = client.CustomerTenants.Create(token, customerTenantDetailed); ``` -------------------------------- ### API Request Example Source: https://apidocs.crayon.com/_sources/scenarios/subscription-create Demonstrates a POST request to the Crayon API for creating subscriptions, including required headers like Accept, Content-Type, and Authorization. ```http POST https://api.crayon.com/api/v1/subscriptions/ HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer < Token > ``` -------------------------------- ### POST /api/v1/customertenants/ Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create Creates a new customer tenant with the provided details. This operation requires authentication and specific customer tenant information. ```APIDOC ## POST /api/v1/customertenants/ ### Description Creates a new customer tenant. ### Method POST ### Endpoint https://api.crayon.com/api/v1/customertenants/ ### Parameters #### Request Body - **customertenant** (CustomerTenantDetailed) - Required - The customer tenant to create ### Request Example ```json { "Tenant": { "CustomerTenantType": 2, "DomainPrefix": "mycustomer", "InvoiceProfile": { "Id": "" }, "Name": "My customer AB", "Organization": { "Id": "" }, "Publisher": { "Id": "" } }, "Profile": { "Address": { "FirstName": "firstname", "LastName": "lastname", "AddressLine1": "addressline 1", "City": "city", "Region": "state", "CountryCode": "SE", "PostalCode": "181 61" }, "Contact": { "FirstName": "firstname", "LastName": "lastname", "Email": "firstname.lastname@email.com", "PhoneNumber": "000-12345689" } }, "Company": { "OrganizationRegistrationNumber": "12345678" } } ``` ### Response #### Success Response (200) - **[Response Fields]** - Details of the created customer tenant. #### Response Example ```json { "TenantId": "", "Name": "My customer AB", "DomainPrefix": "mycustomer" } ``` ``` -------------------------------- ### Get Address API Request Example Source: https://apidocs.crayon.com/scenarios/address-get This section shows an example of an HTTP GET request to retrieve a specific address. It includes the request URI, required headers such as Authorization, Accept, and Content-Type. The organizationId and id are path parameters. ```http GET $"https://api.crayon.com/api/v1/organizations/{organizationId}/addresses/{id}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Create User API Request Example Source: https://apidocs.crayon.com/scenarios/user-create This section provides an example of the HTTP POST request to create a user. It includes the request URI, required headers such as Authorization, Accept, and Content-Type, and an example JSON payload for the request body. ```http POST $"https://api.crayon.com/api/v1/users/" Accept: application/json Content-Type: application/json Authorization: Bearer < Token > { "UserName": "myuser@company.com", "FirstName": "Firstname", "LastName": "LastName" } ``` -------------------------------- ### Get Coterminosity Dates API Request Example Source: https://apidocs.crayon.com/_sources/scenarios/subscriptions-coterminosity This example demonstrates how to make a GET request to the coterminosity API endpoint. It requires OrganizationId, CustomerTenantId, and TermDuration as parameters. SubscriptionId is optional and used for scheduling next term instructions. ```HTTP GET https://api.crayon.com/api/v2/subscriptions/coterminosity?organizationId={organizationId}&customerTenantId={customerTenantId}&subscriptionId={subscriptionId}&termDuration={termDuration} ``` -------------------------------- ### Consumer Creation Request Example (JSON) Source: https://apidocs.crayon.com/_sources/scenarios/consumer-create This JSON represents an example request body for creating a consumer. It includes the consumer object with its properties and specifies the necessary HTTP headers for authorization, content type, and accept type. ```json POST "https://api.crayon.com/api/v1/consumers/" Accept: application/json Content-Type: application/json Authorization: Bearer < Token > ``` -------------------------------- ### POST /users Source: https://apidocs.crayon.com/resources/User Creates a new user account. ```APIDOC ## Create User ### Description Creates a new user account with the provided details. ### Method POST ### Endpoint `/users` ### Parameters #### Request Body - **UserName** (string) - Required - The username for the new user. - **FirstName** (string) - Required - The first name of the new user. - **LastName** (string) - Required - The last name of the new user. - **Email** (string) - Required - The email address for the new user. - **Password** (string) - Required - The password for the new user. - **PhoneNumber** (string) - Optional - The phone number for the new user. ### Request Example ```json { "UserName": "newuser@company.com", "FirstName": "New", "LastName": "User", "Email": "newuser@company.com", "Password": "SecurePassword123!", "PhoneNumber": "123-456-7890" } ``` ### Response #### Success Response (201) - **Id** (string) - The unique identifier of the newly created user. #### Response Example ```json { "Id": "NEW-USER-ID-GUID" } ``` ``` -------------------------------- ### HTTP Request Example for Get Export Queue Source: https://apidocs.crayon.com/scenarios/exportqueue-get This example shows the structure of an HTTP GET request to retrieve export queue items. It includes necessary headers such as Authorization, Accept, and Content-Type. The endpoint is `https://api.crayon.com/api/v1/exports/`. ```http GET https://api.crayon.com/api/v1/exports/ Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Invoice Profile Request Example (HTTP) Source: https://apidocs.crayon.com/scenarios/invoiceprofile-get This section provides an example of an HTTP GET request to retrieve an invoice profile. It specifies the request URI, including the profile ID, and lists the required 'Accept' and 'Authorization' headers. ```http GET $"https://api.crayon.com/api/v1/invoiceprofiles/{id}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### User Creation API Source: https://apidocs.crayon.com/_sources/resources/User Creates a new user in the system. ```APIDOC ## POST /users ### Description Creates a new user. ### Method POST ### Endpoint /users ### Parameters #### Request Body - **UserName** (string) - Required - The username for the new user. - **FirstName** (string) - Optional - The first name of the user. - **LastName** (string) - Optional - The last name of the user. - **Email** (string) - Required - The email address of the user. - **PhoneNumber** (string) - Optional - The phone number of the user. - **TenantAdmin** (string) - Optional - Indicates if the user is a tenant administrator. - **Password** (string) - Required - The password for the new user. ### Request Example ```json { "UserName": "johndoe", "FirstName": "John", "LastName": "Doe", "Email": "john.doe@example.com", "PhoneNumber": "123-456-7890", "TenantAdmin": "false", "Password": "SecurePassword123!" } ``` ### Response #### Success Response (201) - **Id** (string) - The unique identifier of the newly created user. - **UserName** (string) - The username of the created user. - **Email** (string) - The email address of the created user. #### Response Example ```json { "Id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "UserName": "johndoe", "Email": "john.doe@example.com" } ``` ``` -------------------------------- ### POST /api/customer-tenants Source: https://apidocs.crayon.com/scenarios/customertenant-create Creates a new customer tenant. This requires valid credentials, a customer tenant type, and an invoice profile identifier. ```APIDOC ## POST /api/customer-tenants ### Description Creates a new customer tenant. This requires valid credentials, a customer tenant type, and an invoice profile identifier. ### Method POST ### Endpoint /api/customer-tenants ### Parameters #### Request Body - **Tenant** (CustomerTenant) - Required - Details of the customer tenant. - **CustomerTenantType** (integer) - Required - The type of the customer tenant. - **DomainPrefix** (string) - Required - The domain prefix for the tenant. - **InvoiceProfile** (ObjectReference) - Required - Reference to the invoice profile. - **Id** (string) - Required - The ID of the invoice profile. - **Name** (string) - Required - The name of the customer tenant. - **Organization** (Organization) - Required - Details of the organization. - **Id** (string) - Required - The ID of the organization. - **Publisher** (ObjectReference) - Required - Reference to the publisher. - **Id** (string) - Required - The ID of the publisher. - **Profile** (CustomerTenantProfile) - Optional - Profile details for the customer tenant. - **Address** (CustomerTenantAddress) - Optional - Address details. - **FirstName** (string) - Optional - First name. - **LastName** (string) - Optional - Last name. - **AddressLine1** (string) - Optional - Address line 1. - **City** (string) - Optional - City. - **Region** (string) - Optional - State or region. - **CountryCode** (string) - Optional - Country code (e.g., SE). - **PostalCode** (string) - Optional - Postal code. - **Contact** (CustomerTenantContact) - Optional - Contact details. - **FirstName** (string) - Optional - First name. - **LastName** (string) - Optional - Last name. - **Email** (string) - Optional - Email address. - **PhoneNumber** (string) - Optional - Phone number. - **Company** (CustomerTenantCompany) - Optional - Company details. - **OrganizationRegistrationNumber** (string) - Optional - Organization registration number. ### Request Example ```json { "Tenant": { "CustomerTenantType": 2, "DomainPrefix": "mycustomer", "InvoiceProfile": { "Id": "" }, "Name": "My customer AB", "Organization": { "Id": "" }, "Publisher": { "Id": "" } }, "Profile": { "Address": { "FirstName": "firstname", "LastName": "lastname", "AddressLine1": "addressline 1", "City": "city", "Region": "state", "CountryCode": "SE", "PostalCode": "181 61" }, "Contact": { "FirstName": "firstname", "LastName": "lastname", "Email": "firstname.lastname@email.com", "PhoneNumber": "000-12345689" } }, "Company": { "OrganizationRegistrationNumber": "12345678" } } ``` ### Response #### Success Response (200) - **result** (CustomerTenantDetailed) - Details of the created customer tenant. #### Response Example ```json { "result": { "Tenant": { "CustomerTenantType": 2, "DomainPrefix": "mycustomer", "InvoiceProfile": { "Id": "" }, "Name": "My customer AB", "Organization": { "Id": "" }, "Publisher": { "Id": "" } }, "Profile": { "Address": { "FirstName": "firstname", "LastName": "lastname", "AddressLine1": "addressline 1", "City": "city", "Region": "state", "CountryCode": "SE", "PostalCode": "181 61" }, "Contact": { "FirstName": "firstname", "LastName": "lastname", "Email": "firstname.lastname@email.com", "PhoneNumber": "000-12345689" } }, "Company": { "OrganizationRegistrationNumber": "12345678" } } } ``` ``` -------------------------------- ### Get Organization by ID REST API Request Example Source: https://apidocs.crayon.com/_sources/scenarios/organization-get This example shows the HTTP GET request to retrieve an organization by its ID. It specifies the request URI, accepted content types, and the required Authorization header with a Bearer token. ```http GET $"https://api.crayon.com/api/v1/organizations/{{id}}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get billing statements HTTP Request Example Source: https://apidocs.crayon.com/scenarios/billingstatements-get This example shows the structure of an HTTP GET request to retrieve billing statements from the Crayon API. It includes the request URI with query parameters and the necessary headers for authorization and content negotiation. ```http GET $"https://api.crayon.com/api/v1/billingstatements/?organizationId={organizationId}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### C# Sample Programs for Crayon API Source: https://apidocs.crayon.com/getting-started/developing Access sample programs written in C# to demonstrate Crayon API usage. ```APIDOC ## Samples - C# Sample Program ### Description Sample programs in C# are available to illustrate how to use the Crayon API. These examples can help you understand authentication, making requests, and processing responses. ### Language C# ``` -------------------------------- ### GET Request Example for Groupings API Source: https://apidocs.crayon.com/_sources/scenarios/groupings-get This example demonstrates how to make a GET request to the Crayon API's Groupings endpoint. It includes the necessary URL parameters and headers such as Accept, Content-Type, and Authorization. The response is expected to be a collection of Grouping resources. ```HTTP GET "https://api.crayon.com/api/v1/groupings/?organizationId={organizationId}&search={search}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Customer Tenant Creation API Source: https://apidocs.crayon.com/scenarios/customertenant-create This API endpoint is used to create a new customer tenant. Upon successful creation, it returns a detailed customer tenant resource. ```APIDOC ## POST /websites/apidocs_crayon ### Description Creates a new customer tenant and returns the created customer tenant as a CustomerTenantDetailed resource. ### Method POST ### Endpoint /websites/apidocs_crayon ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Not specified in the provided text, assuming it would contain tenant creation details) ### Request Example ```json { "tenantDetails": "..." } ``` ### Response #### Success Response (200 OK) - **Tenant** (object) - The created customer tenant details. - **User** (object) - User credentials for the new tenant. - **Profile** (object) - Profile information for the tenant. - **Company** (object) - Company details associated with the tenant. #### Response Example ```json { "Tenant": { "Id": 1, "Name": "My customer AB", "Publisher": { "Id": 2, "Name": "Microsoft" }, "PublisherCustomerId": "ba3a5b70-9fcd-4f48-9150-91303499bea5", "ExternalPublisherCustomerId": "893f7bfb-866e-4aa2-a3dd-f7d4f9ab8552", "DomainPrefix": "mycustomer", "Reference": "My customer", "CustomerTenantType": 2, "EntityStatus": 0, "Organization": { "Id": 1, "Name": "My company AB" }, "InvoiceProfile": { "Id": 7, "Name": "My invoice profile" } }, "User": { "UserName": "username", "Password": "password" }, "Profile": { "CultureCode": "en-US", "LanguageCode": "en", "Contact": { "FirstName": "Firstname", "LastName": "Lastname", "Email": "firstname.lastname@email.com", "PhoneNumber": "000-12345689" }, "Address": { "FirstName": "Firstname", "MiddleName": "Middlename", "LastName": "Lastname", "AddressLine1": "Streetaddress 4", "AddressLine2": "", "AddressLine3": "", "City": "City", "Region": "", "PostalCode": "123456", "CountryCode": "US", "CountryName": null } }, "Company": { "OrganizationRegistrationNumber": "12345678" } } ``` #### Error Responses - **400 Bad Request**: The request could not be understood due to malformed syntax or missing/invalid properties. - **401 Unauthorized**: The request requires user authentication. - **502 Bad Gateway**: An incorrect response was received from an upstream server. ``` -------------------------------- ### Get Billing Statement Excel File Request Example Source: https://apidocs.crayon.com/scenarios/billingstatementfile-get This example shows the HTTP GET request to retrieve a billing statement file. It specifies the request URI, including the billing statement ID, and required headers such as Authorization and Accept. ```http GET $"https://api.crayon.com/api/v1/billingstatements/file/{id}/" Accept : application/json Authorization : Bearer < Token > ``` -------------------------------- ### CustomerTenantRequest JSON Example Source: https://apidocs.crayon.com/_sources/scenarios/customertenant-create An example JSON payload for creating a customer tenant. This payload includes essential properties like LastName, PostalCode, Region, Email, FirstName, PhoneNumber, and OrganizationRegistrationNumber. ```json { "LastName": "string", "PostalCode": "string", "Region": "string", "Email": "string", "FirstName": "string", "PhoneNumber": "string", "OrganizationRegistrationNumber": "string" } ``` -------------------------------- ### Get Invoice Profiles API Request Example Source: https://apidocs.crayon.com/scenarios/invoiceprofiles-get This example illustrates an HTTP GET request to the Crayon API endpoint for retrieving invoice profiles. It shows the URL structure with query parameters and required headers like Authorization, Accept, and Content-Type. ```http GET $"https://api.crayon.com/api/v1/invoiceprofiles/?organizationId={organizationId}&search={search}&page={page}&pageSize={pageSize}" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ``` -------------------------------- ### Get Subscription Request Example - Crayon API Source: https://apidocs.crayon.com/_sources/scenarios/subscription-get An example HTTP GET request to retrieve a subscription by its ID. This includes the request URI, supported headers like Authorization, Accept, and Content-Type. The ID is a path parameter that uniquely identifies the subscription. ```http GET $"https://api.crayon.com/api/v1/subscriptions/{id}/" Accept : application/json Content-Type: application/json Authorization : Bearer < Token > ```