...
The REST is our architectural standard for our API; it makes it easy to understand and easier to integrate into systems. In entity names, we are using the singular, not the plural. We use user and not users, as we think of an entity as being both singular and plural like a database table.
HTTP VERB | Operation |
---|---|
GET | Is to retrieve one or more entries. Example: GET https://api.ctci.ai/api/v1/user retrieves all users. |
POST | For the creation of an entity such as user, company, notification filter, notification group, notification delivery, processed, etc. |
PUT | This is used to update entries. Example: PUT https://api.ctci.ai/api/v1/user/<id> would update the user with the <id> |
DELETE | This is used to delete an entry. Example: DELETE https://api.ctci.ai/api/v1/user/<id> would delete the user with the <id> |
Specification - Swagger / OAS
...
How to get your credentials:
The preferred way: your company has been created by the CTCI team. If you want to start a trial, then send an email to sales@ctci.ai. Then register yourself as a user with an email address the same as the company email domain. You will then be able to log in and view the API tokens for your company. Depending on whether you have a CEWL subscription, is whether you see the full CEWL list or the restricted list. Tokens
Register as a user, confirm your address and then perform a login API request with your user name and password. your username and password. This will give you restricted access to the CEWL list - only the NSA Chinese State Actors list. CTCI Portal We call this the JWT tokens for API.
Sending API Request
Authentication Tokens must be sent in every request. The examples below are to download the CEWL list.
...
Using Python
Code Block | ||
---|---|---|
| ||
# it needs requests import json import requests from os import environ import pandas as pd # grabs the CEWL API Token from environment variables, use whatever mechanism you want for secretes # TODO add your own exception handling around requests url = "https://api.ctci.ai/api/v1/cewl?q=" # empty filter will just download all of CEWL #query_filter = '' # put whatever you need in the query string query_filter = 'vendor="microsoft"' payload={} headers = { 'x-api-key': '<Put the API Token here>' }environ['CEWL_API_TOKEN'] } # TODO put in your exception handling with try_except around the requests call. response = requests.request("GET", f'{url}{query_filter}', headers=headers, data=payload) if response.status_code == 200: cve_data = json.loads(response.text) # to see what it returned # print(response.text)cve_data) if cve_data: # put it as a pandas dataframe cve_df = pd.DataFrame(cve_data["data"]) # now whatever ya need :) print(cve_df) else: print(f"Error status_code is:{response.status_code}") print("Error in retrieving CEWL entries, check API Token used") print("do your error handling") |
Using JavaScript
Code Block | ||
---|---|---|
| ||
var myHeaders = new Headers(); myHeaders.append("x-api-key", "<Put the API Token here>"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch("https://api.ctci.ai/api/v1/cewl", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); |
...
Basically, this standard has some common values on errors, and then you can add your own specific error values.
We support:
Problem Details Fields RFC 7807 | CTCI API |
---|---|
status | Used - it’s the HTTP return status |
title | The summary of the response |
detail | More information about the response |
type | Type of error |
instance | This is the request path |
parameter | any specific value that is sent in the request that may help to diagnose the error |
data | Used only on success, this is the JSON of the response for the successful request. |
Error Response
Example
Code Block | ||
---|---|---|
| ||
{"status": 400, "title": "The user does not exist", "detail": "The user with user_id:999999 does not exist", "type": "Bad Request", "instance": "/api/v1/user/999999", "parameter": 999999} |
...