Secure Code Warrior provides a suite of APIs to enable access to your company's data via a client application, typically a Business Intelligence tool or platform.
Our new Reporting API is powered by GraphQL, which uses a different format for querying data than the REST API endpoints you might be used to.
Note: Not all existing data and functionality from the existing REST API will be replicated to the new API. If you are unsure which is the best query or endpoint for the data you are looking for, please reach out to our support team!
Generate API Key
The same API keys (either read-only Reporting API keys, or read-write Management API keys) that you have set up for SCW's REST API also work with the Reporting API. The only difference is that the header needs to be in the format
{
"Authorization": "Bearer YOUR_SCW_API_KEY_HERE"
}
For more information on how to create and revoke API keys in SCW, see How to enable API access.
Reporting API Documentation
Reporting API explorer and detailed documentation are available via the links below:
Explore Secure Code Warrior Reporting API
Please follow the steps below to get started
Step 1
Navigate to the Query Explorer using the links above
Step 2
Add your API key to the 'Headers' section
Step 3
Follow the schema documentation by clicking the 📔 icon on the top left.
Step 3a
If the schema documentation is not available, make sure you have added your API key to the 'Headers' section, and click the 'Re-fetch GraphQL schema' button.
Step 4
Try out GraphQL Queries by writing them in the middle viewport. Two important things to remember:
- Wrap the query in curly brackets {}
- Specify the fields that you want the API to return.
If you are new to GraphQL, this article provides a beginner's guide to writing your first GraphQL queries.
Step 5
Run the Query. You will see the result on the right side.
Step 6
Once you have found the data you are looking for with your GraphQL query, you can submit it in the body of a POST query to the relevant GraphQL API endpoint listed below.
GraphQL API Endpoint
POST https://api.us.securecodewarrior.com/graphql
POST https://api.eu.securecodewarrior.com/graphql
Note: Reporting API uses a pagination style provided by Relay (https://relay.dev/graphql/connections.htm). Each query will return an object with 'edges' and 'pageInfo'. The data being queried will be nested inside the 'edges' object as an array of 'nodes' that hold your data. The 'pageInfo' object will contain everything you need to know if there is a next page of data to fetch, and the cursor to use to fetch it.
Some GraphQL client applications that might help you make queries:
Useful Links:
Comments
0 comments
Please sign in to leave a comment.