### GET Request Example: Retrieving Markets with Pagination Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This example illustrates how to use GET requests with offset and limit parameters to retrieve market data from the CSO API. This is useful for managing large datasets and optimizing response times. The example fetches 5 markets starting from the 10th position. ```text https://{name_of_cso_site}/api/markets?offset=10&limit=5 ``` -------------------------------- ### CSO API - Get Started Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi Provides an overview of the CSO API, its terminology, authentication methods, and request types. ```APIDOC ## Introduction to the CSO OpenAPI The CSO API facilitates the creation, updating, and retrieval of data within CSO, enabling data exchange with third-party systems. ## Terminology and Syntax API calls use the `https://` protocol. Resources are identified by their data type (e.g., market, event, fact sheet) followed by their ID: `https://{name_of_cso_site}/api/{resource_name}/{resource_id}` The base URL for a customer site is `{company_name}.cso.coupahost.com`. API calls use JSON (JavaScript Object Notation) format for data exchange. ## Authentication Authentication is handled via a unique API key generated by Coupa. - The API key must be included in the `X-CSO-API-KEY` header. - The `Accept` header must be set to `application/json`. ## Requests ### Example Request for Fact Sheet Fields To retrieve fields for a specific fact sheet within an event: `https://{name_of_cso_site}/api/events/12312224/fact-sheets/342333/fields` It may require multiple requests to obtain specific data, such as first retrieving event IDs, then fact sheet IDs. To optimize performance for large data sets, use `offset` and `limit` parameters or process data in smaller chunks. ## Request Methods ### GET (Read data) Queries the CSO database and returns matching information. The default limit for objects returned is 250. **Parameters:** - **limit** (integer) - Optional - Specifies the number of objects to return. - **offset** (integer) - Optional - Specifies the starting position in the data set. **Example:** `https://{name_of_cso_site}/api/markets?offset=10&limit=5` ### PUT (Update data) Updates existing data in CSO with data from the third-party system. **Endpoint Examples:** - `api/markets/{id}` - Updates a specific market by its ID. - `api/markets` - Updates multiple markets specified in the request body by their IDs. Updates are performed leniently; a failure in one resource update does not prevent others from succeeding. ### POST (Create or Insert data) Creates or inserts new data into a specified resource in CSO. If successful, returns the ID of the newly created resource. ### DELETE (Delete data) Supports deletion of data for certain resource types, either individually or in bulk. **Caution:** Data deleted using this method is permanently removed and cannot be recovered. Use with extreme care. ``` -------------------------------- ### Coupa Approvals API: GET Request Example Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/transactional-resources/approvals-api-%28approvals%29/approvals-api-example-calls This example demonstrates how to query for a specific approval using the Coupa API. It shows a GET request to retrieve approval details based on status and date parameters. The expected response format is XML. ```URL //.coupahost.com/api/requisitions?status=ordered&created-at[gt]=2010-01-01&created-at[lt]=2010-02-01 ``` -------------------------------- ### Coupa Requisitions API - GET Request Example Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/transactional-resources/requisitions-api-%28requisitions%29/requisitions-api-example-calls Demonstrates how to make a GET request to retrieve requisition data using the Coupa Requisitions API. This typically involves specifying the API endpoint and any necessary parameters. No external dependencies are strictly required for this basic request, but an API key and endpoint URL are essential inputs. ```http GET https://.coupahost.com/api/requisitions?limit=10&offset=0 HTTP/1.1 Host: .coupahost.com Authorization: Basic ``` -------------------------------- ### Create Account API Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/accounts-api-%28accounts%29/accounts-api-example-calls Examples for creating new accounts, with options to specify account names and multiple segments. ```APIDOC ## POST /api/accounts ### Description Creates a new account in the system. ### Method POST ### Endpoint `/api/accounts` ### Request Body - **account** (object) - The account object to create. - **active** (boolean) - Required - Specifies if the account is active. - **name** (string) - Optional - The name of the account. - **segment-1** (string) - Required - The value for the first segment. - **segment-2** (string) - Optional - The value for the second segment. - **segment-3** (string) - Optional - The value for the third segment. - **account-type** (object) - Required - Details about the account type. - **name** (string) - The name of the account type. ### Request Example #### Create account with account name: ```xml true demo account name SF Marketing Expense Ace Corporate ``` #### Create account with 3 segments: ```xml true SF Marketing Direct Ace Corporate ``` ### Response #### Success Response (201 Created) - **account** (object) - The newly created account details. - **active** (boolean) - Indicates if the account is active. - **code** (string) - The account code. - **id** (integer) - The unique identifier of the account. - **name** (string) - The name of the account. - **segment-1** (string) - The value for the first segment. - **segment-2** (string) - The value for the second segment. - **segment-3** (string) - The value for the third segment. - **account-type** (object) - Details about the account type. - **id** (integer) - The ID of the account type. - **name** (string) - The name of the account type. #### Response Example ```xml true SF-Marketing-Expense 206 demo account name SF Marketing Expense 1 Ace Corporate ``` ``` -------------------------------- ### Get Markets Data Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi Example of a GET request to retrieve market data. It shows the expected JSON response structure including total count and a list of markets with their IDs, names, and descriptions. ```HTTP GET to `https://{name_of_cso_site}/api/markets` ``` ```JSON { "total": 70, "markets": [ { "id": "9219593111199654844", "name": "Market A", "description": "A descriptive text." }, { "id": "9219593111199654844", "name": "Market B" }, … 68 more markets. ] } ``` -------------------------------- ### API Examples: Filtering and Pagination Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/get-started-with-the-api/arguments Provides practical examples of Coupa API requests. The first example filters suppliers by status, while the second filters purchase orders by a specific date. The subsequent examples illustrate pagination by specifying an offset. ```text https://example.coupahost.com/api/suppliers?status=active ``` ```text https://example.coupahost.com/api/purchase_orders?updated_at[gt_or_eq]=2010-12-31 ``` ```text https://example.coupahost.com/api/purchase_orders?offset=50 ``` ```text https://example.coupahost.com/api/purchase_orders?offset=100 ``` -------------------------------- ### DELETE Request Example: Deleting a Resource Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This example illustrates the DELETE request method, used for removing data from CSO. It can be applied to single resources or as a bulk operation. Caution is advised as deletion is permanent and irreversible. ```text DELETE /api/{resource_name}/{resource_id} ``` -------------------------------- ### POST /api/departments Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/departments-api-%28departments%29/departments-api-example-calls Create a new department record. ```APIDOC ## POST /api/departments ### Description Creates a new department record in the system. ### Method POST ### Endpoint `https:///api/departments/` ### Request Body - **name** (string) - Required - The name of the department. - **active** (boolean) - Optional - Indicates if the department is active (defaults to true if not specified). ### Request Example ```xml Marketing false ``` ### Response #### Success Response (201 Created) Returns the newly created department object. #### Response Example (XML or JSON structure of the created department) ``` -------------------------------- ### POST /api/users - Create User Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/get-started-with-the-api/sample-requestsresponses-xml-vs-json Creates a new user account with the provided details. This endpoint is used for onboarding new users into the system. ```APIDOC ## POST /api/users ### Description Creates a new user account with the provided details. ### Method POST ### Endpoint /api/users ### Request Body - **login** (string) - Required - The login username for the user. - **email** (string) - Required - The email address of the user. - **purchasing-user** (boolean) - Required - Indicates if the user is a purchasing user. - **firstname** (string) - Required - The first name of the user. - **lastname** (string) - Required - The last name of the user. ### Request Example ```json { "login": "test1@coupa.com", "email": "test1@coupa.com", "purchasing-user": true, "firstname": "test1", "lastname": "user1" } ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the newly created user. - **created-at** (dateTime) - The timestamp when the user was created. - **updated-at** (dateTime) - The timestamp when the user was last updated. - **login** (string) - The login username of the user. - **email** (string) - The email address of the user. - **purchasing-user** (boolean) - Indicates if the user is a purchasing user. - **firstname** (string) - The first name of the user. - **lastname** (string) - The last name of the user. - **fullname** (string) - The full name of the user. - **active** (boolean) - Indicates if the user account is active. #### Response Example ```json { "id": 606, "created-at": "2016-11-14T11:53:40-08:00", "updated-at": "2016-11-14T11:53:40-08:00", "login": "test1@coupa.com", "email": "test1@coupa.com", "purchasing-user": true, "expense-user": false, "sourcing-user": false, "inventory-user": false, "employee-number": null, "firstname": "test1", "lastname": "user1", "fullname": "test1 user1", "api-user": false, "active": true, "salesforce-id": null, "account-security-type": 0, "authentication-method": "coupa_credentials", "sso-identifier": null, "default-locale": null, "business-group-security-type": null, "edit-invoice-on-quick-entry": false, "avatar-thumb-url": null, "mention-name": "test1user1", "gpo-entity": null, "radio-button-test": null, "subsidary": null, "function": null, "seg3default": null, "roles": [ { "id": 3, "created-at": "2011-08-05T09:46:31-07:00", "updated-at": "2011-08-05T09:46:31-07:00", "name": "User", "description": "Standard role for all users who need to create and/or approve requisitions", "omnipotent": false, "system-role": true, "updated-by": { "id": 1, "login": "coupasupport", "firstname": "Coupa", "lastname": "Support", "employee-number": "", "email": "upgrade+coupasupport@coupa.com", "salesforce-id": null, "avatar-thumb-url": null, "created-at": "2006-02-16T06:01:34-08:00", "updated-at": "2016-11-14T11:52:00-08:00" } } ], "expenses-delegated-to": [], "can-expense-for": [], "content-groups": [], "account-groups": [], "approval-groups": [], "working-warehouses": [], "inventory-organizations": [], "created-by": { "id": 80, "login": "learnapi", "firstname": "API", "lastname": "API", "employee-number": null, "email": "learnapi@learnapi.com", "salesforce-id": null, "avatar-thumb-url": null, "created-at": "2013-05-15T15:05:17-07:00", "updated-at": "2016-03-30T02:35:20-07:00" }, "updated-by": { "id": 80, "login": "learnapi", "firstname": "API", "lastname": "API", "employee-number": null, "email": "learnapi@learnapi.com", "salesforce-id": null, "avatar-thumb-url": null, "created-at": "2013-05-15T15:05:17-07:00", "updated-at": "2016-03-30T02:35:20-07:00" } } ``` ``` -------------------------------- ### Market Data Operations Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This section covers the API endpoints for retrieving, creating, and updating market data, including request and response examples. ```APIDOC ## GET /api/markets ### Description Retrieves a list of markets. Supports filtering and pagination. ### Method GET ### Endpoint `https://{name_of_cso_site}/api/markets` ### Query Parameters - **name** (string) - Optional - Filters markets by exact name. - **name[contains]** (string) - Optional - Filters markets by names containing the specified text. - **name[starts_with]** (string) - Optional - Filters markets by names starting with the specified text. - **name[ends_with]** (string) - Optional - Filters markets by names ending with the specified text. - **limit** (integer) - Optional - Limits the number of results returned. ### Request Example ``` GET https://{name_of_cso_site}/api/markets?limit=50&name[contains]=european ``` ### Response #### Success Response (200) - **total** (integer) - The total number of markets matching the query. - **markets** (array) - An array of market objects. - **id** (string) - The unique identifier for the market. - **name** (string) - The name of the market. - **description** (string) - The description of the market (optional). #### Response Example ```json { "total": 70, "markets": [ { "id": "9219593111199654844", "name": "Market A", "description": "A descriptive text." }, { "id": "9219593111199654844", "name": "Market B" }, ... ] } ``` ## POST /api/markets ### Description Creates a new market. ### Method POST ### Endpoint `https://{name_of_cso_site}/api/markets` ### Request Body - **name** (string) - Required - The name of the market. - **description** (string) - Optional - A description for the market. ### Request Example ```json { "name": "First Market", "description": "Optional text that describes the market." } ``` ### Response #### Success Response (201) - **result** (array) - An array of result objects indicating the operation status. - **type** (string) - The type of result (e.g., "api.post.added"). - **description** (string) - A description of the result. - **added** (integer) - The number of objects added. - **markets** (array) - An array containing the IDs of the newly created markets. - **id** (string) - The ID of the created market. #### Response Example ```json { "result": [ { "type": "api.post.added", "description": "1 objects created." } ], "added": 1, "markets": [ { "id": "9219593535573352536" } ] } ``` ## PUT /api/markets/{market_id} ### Description Updates an existing market. ### Method PUT ### Endpoint `https://{name_of_cso_site}/api/markets/{market_id}` ### Path Parameters - **market_id** (string) - Required - The ID of the market to update. ### Request Body - **name** (string) - Optional - The updated name for the market. - **description** (string) - Optional - The updated description for the market. ### Request Example ```json { "name": "First Market with updated name" } ``` ### Response #### Success Response (200) - **result** (array) - An array of result objects indicating the operation status. - **type** (string) - The type of result (e.g., "api.put.updated"). - **description** (string) - A description of the result. - **updated** (integer) - The number of objects updated. #### Response Example ```json { "result": [ { "type": "api.put.updated", "description": "1 objects updated." } ], "updated": 1 } ``` ``` -------------------------------- ### POST Request Example: Creating or Inserting Data Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This example outlines the use of the POST request method for creating new data or inserting resources into CSO. Upon successful creation, the API will return the ID of the newly created data or resource. ```text POST /api/{resource_name} ``` -------------------------------- ### POST /supplier-information-sites Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/supplier-information-sites-api-%28supplier_information_sites%29-da-5815-da-5815 Creates a new supplier information site. ```APIDOC ## POST /supplier-information-sites ### Description Creates a new supplier information site with the provided details. ### Method POST ### Endpoint /supplier-information-sites ### Parameters #### Request Body - **code** (string(20)) - Required - Supplier code. - **name** (string(255)) - Required - Supplier Information name. - **po_method** (string(255)) - Optional - Purchase order transmission method. - **po_change_method** (string(255)) - Optional - Purchase order change transmission method. - **default_locale** (string(255)) - Optional - Default Locale for sending emails to this supplier site. - **cxml_url** (string(255)) - Optional - URL where POs are sent if PO transmission is "cxml". - **cxml_domain** (string(255)) - Optional - "From" , our domain. - **cxml_identity** (string(255)) - Optional - "From", our identity. - **cxml_supplier_domain** (string(255)) - Optional - "To", supplier domain. - **cxml_supplier_identity** (string(255)) - Optional - "To", supplier identity. - **cxml_secret** (string(255)) - Optional - Shared secret. - **cxml_protocol** (string(255)) - Optional - Transmission protocol. - **cxml_http_username** (string(255)) - Optional - User name required to access the Supplier's online store. - **cxml_ssl_version** (string(255)) - Optional - Specify the SSL version used for cXML communication with the supplier. - **buyer_hold** (boolean) - Optional - Hold all POs for buyer review. - **disable_cert_verify** (boolean) - Optional - Specify whether to ignore SSL certificate mismatch errors. - **po_email** (string(255)) - Optional - Email where POs are sent if PO transmission is "email". - **active** (boolean) - Optional - true if the site is active. - **allow_change_requests** (integer) - Optional - Allows suppliers to create change requests from CSP. - **supplier_information_id** (integer) - Optional - Supplier Information id. - **payment_term** (string) - Optional - Default payment term, selectable from drop down. - **shipping_term** (string) - Optional - Supplier shipping term, selectable from drop down. - **content_groups** (array) - Optional - Content groups. - **addresses** (array) - Optional - Supplier Information Site addresses. - **contacts** (array) - Optional - Supplier Information Site contacts. ### Request Example ```json { "code": "NEW_SUPPLIER_001", "name": "New Supplier Ltd.", "po_method": "email", "po_email": "po@newsupplier.com", "active": true, "supplier_information_id": 789 } ``` ### Response #### Success Response (201) - **id** (integer) - The ID of the newly created supplier information site. - **created_at** (datetime) - The timestamp when the site was created. #### Response Example ```json { "id": 987, "created_at": "2023-10-27T11:00:00+00:00" } ``` ``` -------------------------------- ### PUT Request Example: Updating a Market Resource Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This example demonstrates how to use the PUT request method to update a specific market resource in CSO. The request targets a market identified by its unique ID. Updates can also be applied to multiple markets by providing their IDs in the request body. ```text api/markets/{id} ``` -------------------------------- ### Example Response for GET Suppliers Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/risk-assess-integrations/risk-assess-rest-api/get-suppliers Example JSON response structure for the GET /api/suppliers endpoint. It shows the format of the supplier list, including total count and individual supplier details. ```json { "result": { "totalCount": 1, "suppliers": [ { "entityId": "8df17abd-1ce4-47dd-96a9-03c310ddd230", "name": "Auto_BulkUpload_BE_05032023234658_T2", "supplierNumber": "392", "status": "General_Active", "createdAt": "2023-08-29T17:36:04.303Z", "modifiedAt": "2023-08-29T18:17:07.363Z", "sourceId": null, "sourceObjectType": null, "sourceSystem": null } ] }, "errors": [], "success": true } ``` -------------------------------- ### Content Groups API - POST Create Content Group Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/content-groups-api-%28business_groups%29/content-groups-api-example-calls Demonstrates how to create a new content group using the Content Groups API. ```APIDOC ## POST Create Content Group ### Description Creates a new content group with the provided details. ### Method POST ### Endpoint `/api/business_groups/` ### Parameters #### Request Body - **name** (string) - Required - The name of the content group. - **description** (string) - Optional - A description for the content group. ### Request Example ```xml test sample content group What Pattern Group ``` ### Response #### Success Response (201) Returns the newly created content group details. #### Response Example (XML structure similar to GET single content group response, with the new group's details) ``` -------------------------------- ### Create Department (XML) Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/departments-api-%28departments%29/departments-api-example-calls Demonstrates the XML payload required to create a new department. This example includes the department name and active status. ```XML Marketing false ``` -------------------------------- ### Query Departments by Name and Created By User Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/departments-api-%28departments%29/departments-api-example-calls Demonstrates how to query departments using filter parameters for 'name' and 'created_by[login]'. These examples show direct URL construction for API calls. ```HTTP https://.coupahost.com/api/departments?name=Marketing https://.coupahost.com/api/departments?created_by[login]=coupasupport ``` -------------------------------- ### Filter Markets by Name using GET Request Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi Demonstrates how to filter market data using various string matching operators with a GET request. Supports exact match, contains, starts with, and ends with filters. ```HTTP GET on https://{name_of_cso_site}/api/markets?name=A ``` ```HTTP GET on https://{name_of_cso_site}/api/markets?name[contains]=european ``` ```HTTP GET on https://{name_of_cso_site}/api/markets?name[starts_with]=FTL ``` ```HTTP GET on https://{name_of_cso_site}/api/markets?name[ends_with]=2018 ``` -------------------------------- ### GET Single Account API Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/accounts-api-%28accounts%29/accounts-api-example-calls Example of how to retrieve a single account by its ID using a GET request. ```APIDOC ## GET /api/accounts/{id} ### Description Retrieves a specific account by its ID. ### Method GET ### Endpoint `/api/accounts/{id}` ### Path Parameters - **id** (integer) - Required - The unique identifier of the account to retrieve. ### Request Example `https://.coupahost.com/api/accounts/13` ### Response #### Success Response (200) - **account** (object) - Contains the details of the account. - **active** (boolean) - Indicates if the account is active. - **code** (string) - The account code. - **id** (integer) - The unique identifier of the account. - **name** (string) - The name of the account. - **segment-1** (string) - The value for the first segment. - **segment-2** (string) - The value for the second segment. - **segment-3** (string) - The value for the third segment. - **account-type** (object) - Details about the account type. - **id** (integer) - The ID of the account type. - **name** (string) - The name of the account type. #### Response Example ```xml false SF-Marketing-Indirect 13 SF Marketing Indirect 1 Ace Corporate ``` ``` -------------------------------- ### POST Request for Content Group Creation Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/content-groups-api-%28business_groups%29/content-groups-api-example-calls Illustrates the XML payload required to create a new content group via the API. This example defines the name and description for the new group. ```XML test sample content group What Pattern Group ``` -------------------------------- ### Update Market Data using PUT Request Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi Example of a PUT request to update an existing market. It shows the request body format for modifying market details and the response indicating the number of updated objects. ```HTTP PUT to `https://{name_of_cso_site}/api/markets/{market_id}` ``` ```JSON { "name": "First Market with updated name" } ``` ```JSON { "result": [ { "type": "api.put.updated", "description": "1 objects updated." } ], "updated": 1 } ``` -------------------------------- ### POST /api/items - Create Sample Item Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/accounts-api-%28accounts%29/catalog-items-example-calls This endpoint allows you to create a new item in the Coupa system. Below is an example of the XML request body and the successful XML response. ```APIDOC ## POST /api/items - Create Sample Item ### Description This endpoint allows you to create a new item in the Coupa system. Below is an example of the XML request body and the successful XML response. ### Method POST ### Endpoint `https://.coupahost.com/api/items` ### Request Body - **item** (XML) - The XML payload representing the item to be created. It can include fields like `active`, `description`, `item-number`, `name`, `commodity`, and `uom`. ### Request Example ```xml true Example API Created Item ExpAPI1001 Example API Item 1001 IT EA ``` ### Response #### Success Response (200) - **item** (XML) - The XML payload representing the newly created item, including its unique `id` and timestamps. #### Response Example ```xml 51 true 2011-04-05T09:01:49-07:00 Example API Created Item ExpAPI1001 Example API Item 1001 2011-04-05T09:01:49-07:00 true 2008-10-27T20:04:00Z 2 IT 2010-02-25T00:32:35Z example@coupa.com Example 101 User example example+ke@coupa.com Kyle 16 Eisner administrator example+supportAPI@coupa.com Example 44 API User example+supportAPI@coupa.com EA 1 ``` ``` -------------------------------- ### Create Market Data using POST Request Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi Example of a POST request to create a new market. It includes the request body format and the expected response, which confirms the creation and provides the new market's ID. ```HTTP POST to `https://{name_of_cso_site}/api/markets` ``` ```JSON { "name": "First Market", "description": "Optional text that describes the market." } ``` ```JSON { "result": [ { "type": "api.post.added", "description": "1 objects created." } ], "added": 1, "markets": [ { "id": "9219593535573352536" } ] } ``` -------------------------------- ### API Request Headers for JSON Data Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-cso-api/get-started-with-cso-openapi This example shows the necessary headers for making API requests to the CSO API. The 'X-CSO-API-KEY' header is crucial for authentication, and the 'Accept' header specifies that the response should be in JSON format. ```text X-CSO-API-KEY: YOUR_API_KEY Accept: application/json ``` -------------------------------- ### Create Exchange Rate Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/exchange-rates-api-%28exchange_rates%29/exchange-rates-api-example-calls Creates a new exchange rate entry in the system. ```APIDOC ## POST /api/exchange_rates ### Description Creates a new exchange rate record by posting the details to the API. ### Method POST ### Endpoint `/api/exchange_rates` ### Request Body - **from-currency** (object) - Required - Object containing the 'code' of the source currency. - **code** (string) - Required - The currency code (e.g., 'EUR'). - **to-currency** (object) - Required - Object containing the 'code' of the target currency. - **code** (string) - Required - The currency code (e.g., 'USD'). - **rate** (decimal) - Required - The exchange rate value. - **rate-date** (datetime) - Required - The date the exchange rate is effective. ### Request Example ```xml EUR USD 42.247599959 2009-12-30 ``` ### Response #### Success Response (201 Created) Indicates the exchange rate was successfully created. The response body may contain the created exchange rate record. ``` -------------------------------- ### Query Accounts API Source: https://compass.coupa.com/en-us/products/product-documentation/integration-technical-documentation/the-coupa-core-api/resources/reference-data-resources/accounts-api-%28accounts%29/accounts-api-example-calls Examples of how to query the Accounts API to retrieve a set of accounts based on different criteria. ```APIDOC ## GET /api/accounts ### Description Retrieves a list of accounts based on query parameters. ### Method GET ### Endpoint `/api/accounts` ### Query Parameters - **active** (boolean) - Optional - Filter accounts by their active status. - **segment-1** (string) - Optional - Filter accounts by the value in segment-1. ### Request Example #### Query all inactive accounts: `https://.coupahost.com/api/accounts?active=false` #### Query accounts with segment-1 value 'SF': `https://.coupahost.com/api/accounts?segment-1=SF` ```