### Example HTTP URL for O Series Cloud Deployment Source: https://developer.vertexinc.com/oseries/docs/quick-start This example demonstrates the structure of a URL for making a transaction call to the O Series Cloud deployment's Tax Calculation and Tax GIS API on the Supplies endpoint. It highlights the base URI and the specific endpoint. ```http https://calcconnect.vertexsmb.com/vertex-ws/v2/supplies ``` -------------------------------- ### Get All Roles (Ruby) Source: https://developer.vertexinc.com/oseries/reference/rolescontroller Example Ruby code snippet using the 'net/http' library to fetch all roles. It illustrates how to perform a GET request and parse the JSON response. ```ruby require 'net/http' require 'uri' require 'json' base_url = 'https://http://localhost:8095' version = 'v2' uri = URI.parse("#{base_url}/oseries-auth/#{version}/roles") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == 'https') request = Net::HTTP::Get.new(uri.request_uri) request['accept'] = 'application/json' begin response = http.request(request) if response.is_a?(Net::HTTPSuccess) data = JSON.parse(response.body) puts data data else puts "HTTP Error: #{response.code} #{response.message}" nil end rescue StandardError => e puts "Error fetching roles: #{e.message}" nil end ``` -------------------------------- ### Vertex O Series API - Fields, Endpoints, and Requests Reference Source: https://developer.vertexinc.com/oseries/docs/quick-start Access comprehensive guides for the O Series APIs, including mandatory fields, available endpoints, request structures, and code samples. ```APIDOC ## Vertex O Series API - Developer Resources ### Description This section provides links to essential documentation for understanding and utilizing the O Series APIs effectively. ### Key Resources: #### 1. Mandatory Fields Reference * **Description:** Learn which fields are required for successful requests and responses from the O Series APIs. * **Link:** [Mandatory Fields Reference](https://developer.vertexinc.com/oseries/docs/mandatory-fields-reference) #### 2. Requests Reference * **Description:** Gain insights into sending requests to the O Series APIs, including details on all available endpoints and code samples for various request types. * **Link:** [Requests Reference](https://developer.vertexinc.com/oseries/docs/requests-reference) #### 3. Fields References * **Description:** Explore all fields that can be passed to the O Series APIs. This can also be accessed via the `API Reference` button in the site header. * **Link:** [Fields References](https://developer.vertexinc.com/oseries/docs/fields-reference) * **Alternative Access:** Click the `<> API Reference` button in the site header. ``` -------------------------------- ### Example Tax Area Lookup API Endpoint URL Source: https://developer.vertexinc.com/oseries/docs/get-started-lookup This example shows the URL pattern for accessing tax area lookup API endpoints in Vertex O Series. It includes placeholders for server, port, version, and the specific endpoint. ```http https://example.server.com:8095/vertex-ws/v2/address-lookup ``` -------------------------------- ### Get All Roles (Python) Source: https://developer.vertexinc.com/oseries/reference/rolescontroller Example Python code snippet using the 'requests' library to retrieve all roles. This demonstrates making a GET request and processing the JSON response. ```python import requests base_url = 'https://http://localhost:8095' version = 'v2' def get_all_roles(): url = f'{base_url}/oseries-auth/{version}/roles' headers = { 'accept': 'application/json' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) return data except requests.exceptions.RequestException as e: print(f'Error fetching roles: {e}') get_all_roles() ``` -------------------------------- ### Get All Roles (Node.js) Source: https://developer.vertexinc.com/oseries/reference/rolescontroller Example Node.js code snippet to fetch all roles using the 'node-fetch' library. It shows how to construct the GET request and handle the JSON response. ```javascript const fetch = require('node-fetch'); const baseUrl = 'https://http://localhost:8095'; const version = 'v2'; async function getAllRoles() { try { const response = await fetch(`${baseUrl}/oseries-auth/${version}/roles`, { method: 'GET', headers: { 'accept': 'application/json' } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching roles:', error); } } getAllRoles(); ``` -------------------------------- ### Vertex O Series API - Determine URLs Source: https://developer.vertexinc.com/oseries/docs/quick-start Understand how to construct O Series API URLs, which consist of a base API URI and an endpoint. The base URI varies based on your deployment model and the specific API, while the endpoint depends on the API version and the desired functionality. ```APIDOC ## Vertex O Series API URL Construction ### Description Constructing the correct URL is crucial for interacting with the O Series APIs. URLs are composed of a base URI and a specific endpoint. ### Base API URI The base URI is determined by your deployment model (Cloud, On-Demand, On-Premise) and the API you are accessing. ### Endpoint The endpoint specifies the particular API function or resource you are targeting, and it depends on the API version and the specific operation. ### Example URL Structure `[Base API URI]/[API Version]/[Endpoint]` ### Example for Tax Calculation (Sales) in O Series Cloud Deployment `https://calcconnect.vertexsmb.com/vertex-ws/v2/supplies` ### Deployment Models: * **O Series Cloud:** Uses URIs like `https://calcconnect.vertexsmb.com`. * **O Series On-Demand:** Refer to specific documentation for On-Demand URIs. * **O Series On-Premise:** Refer to specific documentation for On-Premise URIs. ### Related Resources: * [OS Cloud URIs](https://developer.vertexinc.com/oseries/docs/quick-start#os-cloud-uris) * [OS On-Demand URIs](https://developer.vertexinc.com/oseries/docs/quick-start#os-on-demand-uris) * [OS On-Premise URIs](https://developer.vertexinc.com/oseries/docs/quick-start#os-on-premise-uris) ``` -------------------------------- ### Get All Roles (PHP) Source: https://developer.vertexinc.com/oseries/reference/rolescontroller Example PHP code snippet using cURL to retrieve all roles. This demonstrates setting up the cURL request, executing it, and decoding the JSON response. ```php ``` -------------------------------- ### cURL Request Example for Vertex API Source: https://developer.vertexinc.com/oseries/reference/tax-area-lookup This snippet demonstrates how to construct a cURL request to the Vertex Inc. OSeries API. It includes setting the request method to POST, specifying the API endpoint URL, and defining necessary headers like 'accept' and 'content-type'. This is a foundational example for interacting with the API. ```shell curl --request POST \ --url https://developer.vertexcloud.com/api/v2/address-lookup \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` -------------------------------- ### GET /config/v2/commodity-codes Source: https://developer.vertexinc.com/oseries/openapi/66b38fdadf138800114016ab Returns a list of supported commodity code types. ```APIDOC ## GET /config/v2/commodity-codes ### Description Returns a list of supported commodity code types. ### Method GET ### Endpoint /config/v2/commodity-codes ### Response #### Success Response (200) - **array of strings** - A list of supported commodity code types. #### Response Example { "example": "[\"HS\", \"ScheduleB\"]" } ``` -------------------------------- ### POST /config/v2/taxpayers Source: https://developer.vertexinc.com/oseries/openapi/66b38fdadf138800114016ab Create a taxpayer. Adds a new taxpayer configuration to the system. ```APIDOC ## POST /config/v2/taxpayers ### Description Create a taxpayer. Adds a new taxpayer configuration to the system. ### Method POST ### Endpoint /config/v2/taxpayers ### Parameters #### Request Body - **TaxpayerBase** (object) - Required - The configuration of the taxpayer to be created. ### Request Example ```json { "partyId": "string", "partyName": "string", "partyCode": "string" } ``` ### Response #### Success Response (201) - **Taxpayer** (object) - The created taxpayer configuration. #### Response Example ```json { "id": "string", "partyId": "string", "partyName": "string", "partyCode": "string" } ``` ``` -------------------------------- ### Vertex O Series API - Get Access Token Source: https://developer.vertexinc.com/oseries/docs/quick-start Obtain a valid access token required for authenticating requests to the O Series REST APIs. The process for acquiring a token differs based on your O Series deployment type (Cloud, On-Premise, On-Demand). ```APIDOC ## Vertex O Series API Authentication ### Description Authentication is required to interact with the O Series REST APIs. A valid access token must be obtained before making any API calls. ### Obtaining an Access Token The method for obtaining an access token depends on your O Series deployment model: #### 1. Cloud Deployments Follow the steps outlined for obtaining a token in O Series Cloud environments. This typically involves OAuth 2.0 flows. * **Reference:** [Get a token for Cloud deployments](https://developer.vertexinc.com/oseries/docs/quick-start#get-a-token-for-cloud-deployments) #### 2. On-Premise and On-Demand Deployments Follow the specific procedures for acquiring tokens in O Series On-Premise and On-Demand setups. * **Reference:** [Get a token for On-Premise and On-Demand deployments](https://developer.vertexinc.com/oseries/docs/quick-start#get-a-token-for-on-premise-and-on-demand-deployments) ### Token Usage Include the obtained access token in the `Authorization` header of your API requests, typically as a Bearer token. ``` -------------------------------- ### Get All Roles (cURL) Source: https://developer.vertexinc.com/oseries/reference/rolescontroller Example cURL request to retrieve all roles from the oseries-auth API. This demonstrates the GET method, URL, and required headers for the request. ```shell curl --request GET \ --url https://http//localhost:8095/oseries-auth/v2/roles \ --header 'accept: application/json' ``` -------------------------------- ### cURL Request Example for Taxability Drivers API Source: https://developer.vertexinc.com/oseries/reference/driver This snippet demonstrates how to make a POST request to the Vertex O-Series tax-config-api to add a taxability driver. It includes setting the request URL, headers for content type and accept, and a JSON payload specifying the driver type. This example assumes a Bearer token for authentication, which should be added as an Authorization header. ```shell curl --request POST \ --url https://example.com/tax-config-api/config/v2/taxability-drivers \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "driverType": "PRODUCT" }' ``` -------------------------------- ### POST /config/v2/taxpayers - Create a taxpayer Source: https://developer.vertexinc.com/oseries/reference/taxpayer Creates a new taxpayer with the provided configuration details. This endpoint allows for the creation of various taxpayer types with specific configurations for discounts, effective dates, and more. ```APIDOC ## POST /config/v2/taxpayers ### Description Creates a new taxpayer with the provided configuration details. This endpoint allows for the creation of various taxpayer types with specific configurations for discounts, effective dates, and more. ### Method POST ### Endpoint https://example.com/tax-config-api/config/v2/taxpayers ### Parameters #### Request Body - **code** (string) - required - length between 1 and 40 - External System identifier for the taxpayer. - **name** (string) - required - length between 1 and 60 - Full Name for the taxpayer. - **partyTypeId** (integer) - Type of taxpayer (1=Normal, 4=Regulated, 5=Unregulated) - **note** (string) - length between 0 and 1000 - A free-form text for additional taxpayer information. - **parentTaxpayerId** (string) - Stringified UUIDv4. See RFC 4112 - **startDate** (date) - required - The date when the taxpayer becomes effective. - **endDate** (date) - The date after which the taxpayer is no longer effective. - **adoptParentSetup** (boolean) - Defaults to false - Adopt Parent Setup indicates that the current taxpayer entity inherits the tax exceptions of its parent taxpayer. - **filingEntity** (boolean) - Defaults to true - Indicates that the taxpayer is responsible for collecting and remitting taxes by filing tax returns. - **shippingTerms** (string) - enum - Shipping Terms determine the point in a transaction at which title transfer of goods takes place, which impacts identification of the taxing jurisdiction. (EXWFCAFASFOBCFRCIFCPTCIPDAFDESDEQDDUDDPDAPDATSUPCUSDPU) - **discountMappings** (array of objects) - Collection of discount mappings ### Request Example ```json { "code": "TAX123", "name": "Example Taxpayer", "partyTypeId": 1, "startDate": "2023-01-01", "shippingTerms": "FOB", "discountMappings": [ { "discountCategory": "GENERAL_DISCOUNT", "discountCode": "GEN10", "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ] } ``` ### Response #### Success Response (201) - **code** (string) - required - length between 1 and 40 - External System identifier for the taxpayer. - **name** (string) - required - length between 1 and 60 - Full Name for the taxpayer. - **partyTypeId** (integer) - Type of taxpayer (1=Normal, 4=Regulated, 5=Unregulated) - **note** (string) - length between 0 and 1000 - A free-form text for additional taxpayer information. - **parentTaxpayerId** (string) - Stringified UUIDv4. See RFC 4112 - **startDate** (date) - required - The date when the taxpayer becomes effective. - **endDate** (date) - The date after which the taxpayer is no longer effective. - **adoptParentSetup** (boolean) - Defaults to false - Adopt Parent Setup indicates that the current taxpayer entity inherits the tax exceptions of its parent taxpayer. - **filingEntity** (boolean) - Defaults to true - Indicates that the taxpayer is responsible for collecting and remitting taxes by filing tax returns. - **shippingTerms** (string) - enum - Shipping Terms determine the point in a transaction at which title transfer of goods takes place, which impacts identification of the taxing jurisdiction. - **discountMappings** (array of objects) - Collection of discount mappings #### Response Example ```json { "code": "TAX123", "name": "Example Taxpayer", "partyTypeId": 1, "startDate": "2023-01-01", "shippingTerms": "FOB", "discountMappings": [ { "discountCategory": "GENERAL_DISCOUNT", "discountCode": "GEN10", "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ] } ``` #### Error Responses - **400 Bad Request**: The request was invalid (did not have a required parameter) or 1 or more parameters on the request was invalid. - **errorCode** (string) - required - A short Vertex error code. - **errorMessage** (string) - required - A detailed error message. - **401 Authentication failure**: There was no credential attached to the request, or the credential was invalid. - **errorCode** (string) - required - A short Vertex error code. - **errorMessage** (string) - required - A detailed error message. - **403 Authorization failure**: The user or identity requesting the operation did not have the requisite role to perform the operation. - **errorCode** (string) - required - A short Vertex error code. - **errorMessage** (string) - required - A detailed error message. ``` -------------------------------- ### POST /config/v2/taxability-drivers Source: https://developer.vertexinc.com/oseries/openapi/66b38fdadf138800114016ab Creates a new taxability driver. ```APIDOC ## POST /config/v2/taxability-drivers ### Description Create a taxability driver. ### Method POST ### Endpoint /config/v2/taxability-drivers ### Parameters #### Request Body - **TaxabilityDriverBase** (object) - Required - Configuration of the taxability driver to be created. - **code** (string) - Required - The code of the taxability driver. - **name** (string) - Required - The name of the taxability driver. - **description** (string) - Optional - The description of the taxability driver. - **owningPartyCode** (string) - Optional - The code of the owning party. - **owningPartyName** (string) - Optional - The name of the owning party. - **owningTaxpayerId** (string) - Optional - The taxpayer ID of the owning party. ### Response #### Success Response (201) - **TaxabilityDriver** - The created taxability driver object. #### Response Example { "example": "{\"id\": \"a1b2c3d4-e5f6-7890-1234-567890abcdef\", \"code\": \"TAX_EXEMPT\", \"name\": \"Tax Exempt\", \"description\": \"Customer is tax exempt\", \"owningPartyCode\": \"PARTY123\", \"owningPartyName\": \"Example Corp\", \"owningTaxpayerId\": \"987654321\"}" } ``` -------------------------------- ### List Taxpayers with Filter - OSeries API Source: https://developer.vertexinc.com/oseries/docs/list-taxpayers This snippet demonstrates how to list taxpayers using the OSeries API. It utilizes the GET method on the `/config/v2/taxpayers` endpoint and supports filtering via the `$filter` query parameter. The example shows a basic filter condition. ```JSON GET /config/v2/taxpayers? $filter=code eq 'abc', name eq 'Old Navy', code eq 'abc' and name eq 'Old Navy' ``` -------------------------------- ### Sample JSON Request for Buyer Tax Calculation Source: https://developer.vertexinc.com/oseries/docs/calculate-tax-buyer This JSON object represents a sample request to calculate tax for a buyer. It includes transaction details, buyer's address, recipient information, and tax registration data. Ensure all required fields are populated accurately for correct tax calculation. ```json { "transactionType": "PURCHASE", "accumulationCustomerNumber": "string", "accumulationDocumentNumber": "string", "billingType": "string", "buyer": { "administrativeDestination": { "city": "string", "country": "string", "currencyConversion": { "currency": { "isoCurrencyCodeAlpha": "VKF", "isoCurrencyCodeNum": 7605, "isoCurrencyName": "string" }, "rate": 9223.899878428272 }, "externalJurisdictionCode": "string", "latitude": "string", "locationCode": "string", "locationCustomsStatus": "FREE_CIRCULATION", "longitude": "string", "mainDivision": "string", "postalCode": "str", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "stri", "taxAreaId": "string" }, "company": "string", "department": "string", "destination": { "city": "string", "country": "string", "currencyConversion": { "currency": { "isoCurrencyCodeAlpha": "QUJ", "isoCurrencyCodeNum": 5731, "isoCurrencyName": "string" }, "rate": 8912.302517171853 }, "externalJurisdictionCode": "string", "latitude": "s", "locationCode": "str", "locationCustomsStatus": "INWARD_PROCESSING_RELIEF", "longitude": "string", "mainDivision": "string", "postalCode": "str", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "stri", "taxAreaId": "string" }, "division": "str", "exemptionCertificate": { "exemptionCertificateNumber": "string", "value": "string" }, "exemptionReasonCode": "string", "isTaxExempt": true, "recipient": { "recipientCode": { "classCode": "string", "isBusinessIndicator": true, "value": "str" }, "taxRegistrations": [ { "hasPhysicalPresenceIndicator": true, "impositionType": { "impositionTypeId": "string", "userDefined": false, "value": "string", "withholdingType": "string", "informationOnly": true }, "isoCountryCode": "EOZ", "jurisdictionId": "string", "mainDivision": "string", "nexusOverrides": [ { "city": false, "country": true, "district": false, "locationRole": "ADMINISTRATIVE_DESTINATION", "mainDivision": true, "subDivision": true } ], "physicalLocations": [ { "city": "string", "country": "stri", "mainDivision": "string", "postalCode": "string", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "string", "taxAreaId": "string" } ], "taxRegistrationNumber": "string", "filingCurrency": { "isoCurrencyCodeAlpha": "VZF", "isoCurrencyCodeNum": 7458, "isoCurrencyName": "string" }, "taxRegistrationType": "VAT Registration" } ] }, "taxRegistrations": [ { "hasPhysicalPresenceIndicator": true, "impositionType": { "impositionTypeId": "string", "userDefined": false, "value": "string", "withholdingType": "string", "informationOnly": true }, "isoCountryCode": "PB", "jurisdictionId": "string", "mainDivision": "string", "nexusOverrides": [ { "city": true, "country": false, "district": false, "locationRole": "PHYSICAL_ORIGIN", "mainDivision": true, "subDivision": true } ], "physicalLocations": [ { "city": "string", "country": "st", "mainDivision": "string", "postalCode": "strin", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "string", "taxAreaId": "string" } ], "taxRegistrationNumber": "string", "filingCurrency": { "isoCurrencyCodeAlpha": "YUA", "isoCurrencyCodeNum": 2946, "isoCurrencyName": "string" }, "taxRegistrationType": "VAT Registration" } ], "utilityProvider": "REGULATED_TAXPAYER" }, "buyerCondition": "string", "buyerCNAE": "string", "calculateVendorTaxIndicator": false, "calculateSelfAccrualIndicator": false, "chargedTax": 3042.1899598871714, "citationOverrides": [ { "impositionType": { "impositionTypeId": "string", "userDefined": true, "value": "string", "withholdingType": "string", "informationOnly": true } } ] } ``` -------------------------------- ### List Locations using Filter - OSeries API Source: https://developer.vertexinc.com/oseries/docs/list-locations This snippet demonstrates how to list locations using the OSeries API. It utilizes a GET request to the `/config/v2/locations` endpoint and accepts a `$filter` parameter to refine the results. The example filter shows how to specify the `owningPartyId`. ```JSON owningPartyId eq '37f038e2-22ec-4e5b-93f4-f065bea65542'. ``` -------------------------------- ### Tax Area Lookup API Endpoints Source: https://developer.vertexinc.com/oseries/docs/get-started-lookup The O Series Tax Calculation and Tax GIS API enables tax area lookups by postal address, latitude/longitude, Tax Area ID, or jurisdiction-defined code. The server URL follows the pattern /vertex-ws//. ```APIDOC ## GET /vertex-ws/{version}/address-lookup ### Description Retrieves tax area information based on a provided postal address. ### Method GET ### Endpoint `/vertex-ws/{version}/address-lookup` ### Parameters #### Query Parameters - **streetAddress** (string) - Required - The street address for the lookup. - **city** (string) - Required - The city for the lookup. - **state** (string) - Required - The state for the lookup. - **postalCode** (string) - Required - The postal code for the lookup. - **country** (string) - Optional - The country for the lookup (defaults to US if not provided). ### Request Example ```http GET https://example.server.com:8095/vertex-ws/v2/address-lookup?streetAddress=123%20Main%20St&city=Anytown&state=CA&postalCode=90210 ``` ### Response #### Success Response (200) - **taxAreaId** (string) - The unique identifier for the tax area. - **jurisdictions** (array) - A list of jurisdictions associated with the tax area. #### Response Example ```json { "taxAreaId": "12345", "jurisdictions": [ { "jurisdictionName": "City of Anytown", "jurisdictionType": "City" }, { "jurisdictionName": "County of Example", "jurisdictionType": "County" } ] } ``` ``` ```APIDOC ## GET /vertex-ws/{version}/lat-lon-lookup ### Description Retrieves tax area information based on provided latitude and longitude coordinates. ### Method GET ### Endpoint `/vertex-ws/{version}/lat-lon-lookup` ### Parameters #### Query Parameters - **latitude** (number) - Required - The latitude coordinate. - **longitude** (number) - Required - The longitude coordinate. ### Request Example ```http GET https://example.server.com:8095/vertex-ws/v2/lat-lon-lookup?latitude=34.0522&longitude=-118.2437 ``` ### Response #### Success Response (200) - **taxAreaId** (string) - The unique identifier for the tax area. - **jurisdictions** (array) - A list of jurisdictions associated with the tax area. #### Response Example ```json { "taxAreaId": "67890", "jurisdictions": [ { "jurisdictionName": "City of Los Angeles", "jurisdictionType": "City" } ] } ``` ``` ```APIDOC ## GET /vertex-ws/{version}/tax-area-id-lookup ### Description Retrieves jurisdiction information for a given Tax Area ID (TAID). ### Method GET ### Endpoint `/vertex-ws/{version}/tax-area-id-lookup` ### Parameters #### Query Parameters - **taxAreaId** (string) - Required - The Tax Area ID to look up. ### Request Example ```http GET https://example.server.com:8095/vertex-ws/v2/tax-area-id-lookup?taxAreaId=12345 ``` ### Response #### Success Response (200) - **jurisdictions** (array) - A list of jurisdictions associated with the Tax Area ID. #### Response Example ```json { "jurisdictions": [ { "jurisdictionName": "City of Anytown", "jurisdictionType": "City" }, { "jurisdictionName": "County of Example", "jurisdictionType": "County" } ] } ``` ``` ```APIDOC ## GET /vertex-ws/{version}/jurisdiction-code-lookup ### Description Retrieves tax area information based on a jurisdiction-defined code. ### Method GET ### Endpoint `/vertex-ws/{version}/jurisdiction-code-lookup` ### Parameters #### Query Parameters - **jurisdictionCode** (string) - Required - The jurisdiction-defined code. - **jurisdictionType** (string) - Required - The type of jurisdiction (e.g., 'City', 'County'). ### Request Example ```http GET https://example.server.com:8095/vertex-ws/v2/jurisdiction-code-lookup?jurisdictionCode=ANYTOWN&jurisdictionType=City ``` ### Response #### Success Response (200) - **taxAreaId** (string) - The unique identifier for the tax area. - **jurisdictions** (array) - A list of jurisdictions associated with the tax area. #### Response Example ```json { "taxAreaId": "12345", "jurisdictions": [ { "jurisdictionName": "City of Anytown", "jurisdictionType": "City" } ] } ``` ``` -------------------------------- ### Get Supported Commodity Codes (Ruby) Source: https://developer.vertexinc.com/oseries/reference/commoditycode This snippet provides a Ruby implementation for retrieving supported commodity code types. It uses the 'net/http' library to make the GET request to the API. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse("https://example.com/tax-config-api/config/v2/commodity-codes") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true # if you need HTTPS request = Net::HTTP::Get.new(uri.request_uri) request["accept"] = "application/json" begin response = http.request(request) if response.is_a?(Net::HTTPSuccess) commodity_codes = JSON.parse(response.body) puts commodity_codes else puts "Error: #{response.code} #{response.message}" end rescue StandardError => e puts "An error occurred: #{e.message}" end ``` -------------------------------- ### Get Supported Commodity Codes (cURL) Source: https://developer.vertexinc.com/oseries/reference/commoditycode This snippet demonstrates how to retrieve a list of supported commodity code types using a cURL request. It specifies the GET method and the API endpoint URL. ```shell curl --request GET \ --url https://example.com/tax-config-api/config/v2/commodity-codes \ --header 'accept: application/json' ``` -------------------------------- ### Sample JSON Request for Owner Tax Calculation Source: https://developer.vertexinc.com/oseries/docs/calculate-tax-owner This JSON object represents a sample request to the Vertex O Series API for calculating taxes related to an inventory removal event. It includes detailed information about the owner's physical origin, destination, tax registrations, and various currency and document-specific parameters. The structure allows for comprehensive tax determination based on provided location and transaction data. ```json { "ownerMessageType": "INVENTORY_REMOVAL", "accumulationCustomerNumber": "string", "accumulationDocumentNumber": "string", "billingType": "string", "owner": { "physicalOrigin": { "city": "stri", "country": "string", "currencyConversion": { "currency": { "isoCurrencyCodeAlpha": "FXV", "isoCurrencyCodeNum": 9620, "isoCurrencyName": "string" }, "rate": 1091.2574697740074 }, "externalJurisdictionCode": "string", "latitude": "strin", "locationCode": "string", "locationCustomsStatus": null, "longitude": "string", "mainDivision": "string", "postalCode": "str", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "string", "taxAreaId": "string" }, "company": "string", "department": "string", "destination": { "city": "string", "country": "string", "currencyConversion": { "currency": { "isoCurrencyCodeAlpha": "QUH", "isoCurrencyCodeNum": 4946, "isoCurrencyName": "string" }, "rate": 5457.1232433002015 }, "externalJurisdictionCode": "string", "latitude": "string", "locationCode": "strin", "locationCustomsStatus": "INWARD_PROCESSING_RELIEF", "longitude": "string", "mainDivision": "string", "postalCode": "string", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "string", "taxAreaId": "string" }, "division": "string", "exemptionReasonCode": "string", "isTaxExempt": true, "taxRegistrations": [ { "hasPhysicalPresenceIndicator": false, "impositionType": { "impositionTypeId": "string", "userDefined": false, "value": "string", "withholdingType": "string", "informationOnly": true }, "isoCountryCode": "JY", "jurisdictionId": "string", "mainDivision": "string", "nexusOverrides": [ { "city": true, "country": true, "district": false, "locationRole": "ADMINISTRATIVE_DESTINATION", "mainDivision": false, "subDivision": true } ], "physicalLocations": [ { "city": "string", "country": "string", "mainDivision": "string", "postalCode": "string", "streetAddress1": "string", "streetAddress2": "string", "subDivision": "string", "taxAreaId": "string" } ], "taxRegistrationNumber": "string", "filingCurrency": { "isoCurrencyCodeAlpha": "YSV", "isoCurrencyCodeNum": 1008, "isoCurrencyName": "string" }, "taxRegistrationType": "Union Scheme" } ], "utilityProvider": "REGULATED_TAXPAYER" }, "buyerCondition": "string", "buyerCNAE": "string", "citationOverrides": [ { "impositionType": { "impositionTypeId": "string", "userDefined": false, "value": "string", "withholdingType": "string", "informationOnly": false }, "jurisdictionType": "PARISH", "citation": "string", "jurisdictionId": "string" } ], "companyCodeCurrency": { "isoCurrencyCodeAlpha": "YIA", "isoCurrencyCodeNum": 1940, "isoCurrencyName": "string" }, "currency": { "isoCurrencyCodeAlpha": "NSW", "isoCurrencyCodeNum": 3642, "isoCurrencyName": "string" }, "currencyConversionFactors": [ { "conversionFactor": 2874.6041791744447, "sourceCurrency": { "isoCurrencyCodeAlpha": "DRP", "isoCurrencyCodeNum": 7011, "isoCurrencyName": "string" }, "targetCurrency": { "isoCurrencyCodeAlpha": "OSI", "isoCurrencyCodeNum": 7221, "isoCurrencyName": "string" } } ], "deliveryTerm": "CPT", "documentDate": "2025-04-23", "documentNumber": "string", "documentSequenceId": "string", "documentType": "string", "exemptOverrides": [ { "amount": 7772.260165080216, "impositionType": { "impositionTypeId": "string", "userDefined": true, "value": "string", "withholdingType": "string", "informationOnly": false }, "jurisdictionType": "TRADE_BLOCK", "jurisdictionId": "string", "reasonCode": "string" } ], "franchiseAreaId": "string", "impositionInclusions": [ { "impositionType": { "impositionTypeId": "string", "userDefined": false, "value": "string", "withholdingType": "string", "informationOnly": true }, "jurisdictionType": "CITY", "jurisdictionId": "string" } ], "isTaxOnlyAdjustmentIndicator": false, "lineItems": [ ] } ``` -------------------------------- ### Product and Tax Details Source: https://developer.vertexinc.com/oseries/reference/purchasepost Information regarding product mass, tax overrides, and recovery percentages. ```APIDOC ## Product and Tax Details ### Description Details product mass, tax overrides, and recoverable tax percentages for various tax scenarios. ### Parameters #### Request Body - **netMassKilograms** (integer) - The mass of the product in kilograms. - **nonTaxableOverrides** (array) - Overrides for non-taxable amounts. Items are of type NonTaxableOverride. - **partialExemptRecoverableOverridePercent** (number) - The recoverable percentage of a partial exemption. Applicable only for Value Added Tax. - **rateOverrides** (array) - Overrides for tax rates. Items are of type RateOverride. - **taxDeferredOverrides** (array) - Overrides for deferred taxes. Items are of type TaxDeferredOverride. ### Request Example ```json { "netMassKilograms": 1000, "nonTaxableOverrides": [], "partialExemptRecoverableOverridePercent": 50.0, "rateOverrides": [], "taxDeferredOverrides": [] } ``` ### Response #### Success Response (200) - **netMassKilograms** (integer) - The mass of the product in kilograms. - **nonTaxableOverrides** (array) - Applied non-taxable overrides. - **partialExemptRecoverableOverridePercent** (number) - The applied recoverable percentage for partial exemptions. - **rateOverrides** (array) - Applied rate overrides. - **taxDeferredOverrides** (array) - Applied tax deferred overrides. #### Response Example ```json { "netMassKilograms": 1000, "nonTaxableOverrides": [], "partialExemptRecoverableOverridePercent": 50.0, "rateOverrides": [], "taxDeferredOverrides": [] } ``` ``` -------------------------------- ### GET /tax-config-api/config/v2/commodity-codes Source: https://developer.vertexinc.com/oseries/reference/commoditycode Retrieves a list of supported commodity code types. ```APIDOC ## GET /tax-config-api/config/v2/commodity-codes ### Description Returns a list of supported commodity code types. ### Method GET ### Endpoint https://example.com/tax-config-api/config/v2/commodity-codes ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```curl curl --request GET \ --url https://example.com/tax-config-api/config/v2/commodity-codes \ --header 'accept: application/json' ``` ### Response #### Success Response (200) - **(array of strings)**: A list of supported commodity code types. #### Error Response (400) - **errorCode** (string) - A short Vertex error code. - **errorMessage** (string) - A detailed error message. #### Error Response (401) - **errorCode** (string) - A short Vertex error code. - **errorMessage** (string) - A detailed error message. #### Error Response (403) - **errorCode** (string) - A short Vertex error code. - **errorMessage** (string) - A detailed error message. #### Error Response (503) - **errorCode** (string) - A short Vertex error code. - **errorMessage** (string) - A detailed error message. #### Response Example (200) ```json [ "string", "string" ] ``` #### Response Example (400/401/403/503) ```json { "errorCode": "string", "errorMessage": "string" } ``` ``` -------------------------------- ### Get Supported Commodity Codes (Python) Source: https://developer.vertexinc.com/oseries/reference/commoditycode This snippet illustrates how to obtain a list of supported commodity code types using Python. It employs the 'requests' library to send a GET request to the Vertex API. ```python import requests url = "https://example.com/tax-config-api/config/v2/commodity-codes" headers = { "accept": "application/json" } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes commodity_codes = response.json() print(commodity_codes) except requests.exceptions.RequestException as e: print(f"Error fetching commodity codes: {e}") ``` -------------------------------- ### List Commodity Code by Type Request Example Source: https://developer.vertexinc.com/oseries/docs/list-codes-for-type This snippet demonstrates how to construct a request to list commodity codes for a given type. It utilizes a function that likely filters commodity codes based on a name pattern. No specific dependencies are mentioned, and it takes a string pattern as input. ```json { "commodityCodes": [ { "type": "string", "code": "string", "name": "string", "userDefined": false, "mappings": [ { "taxabilityCategoryId": "123e4567-e89b-12d3-a456-426614174000", "categoryName": "string", "categoryDescription": "string", "mappingNote": "string", "startDate": "2022-01-01", "endDate": "2022-12-31" } ] } ], "count": 0, "truncated": true } ```