Skip to content

CodeClarityCE/api

Repository files navigation

codeclarity-logo

Secure your software empower your team.

License

Table of Contents

CodeClarity API

Contributing

If you'd like to contribute code or documentation, please see CONTRIBUTING.md for guidelines on how to do so.

Reporting Issues

Please report any issues with the setup process or other problems encountered while using this repository by opening a new issue in this project's GitHub page.

Purpose

The following repository contains the source code material for our public API, powered by NestJS.

Getting started

  1. make build

  2. make build-dev

  3. TEST_EMAIL=<test-email-address> MAIL_AUTH_PASSWORD=<smtp-password> make up-dev

    1. <test-email-address> is an email address on which you will recieve all emails during development. This is so we do not spam real-world email addresses of real people during development.
    2. <smtp-password> the password needed to authenticate to the smtp server. Under no circumstance put this into one of the .env files!
    3. To make your life easier, export these environment variables in /etc/environment, so you don't need to specify them every time.

API Responses

API data

Every response from the API includes two fields:

  • status a textual indication of whether the request succeeded or not ("success" or "failure")
  • status_code the numerical http status code (200,400, 500, ...)

Every error returned from the API includes two additional fields:

  • error_code a textual error code ("UnkownAnalysis", "UnkownWorkspace", "UnprocessableEntity", ...)
  • error_message an error message/description

Note: that the presence of these fields is enforced by the ExceptionFilter and the ResponseBodyInterceptor.

API conventions

  • Error handling: Our API indicates failures and success via HTTP status codes (200,400, 500) and also by including respective fields in the returned JSON body. Allowing consumers of the API to employ their preffered style of error handling.
    • Success:
      // HTTP status code: 200
      {
          "status_code": 200,
          "status": "success",
          "data": { ... }
      }
    • Error:
      // HTTP status code: 400
      {
          "status_code": 400,
          "status": "failure",
          "error_code": "UnkownWorkspace",
          "error_message": "The referenced workspace does not exist"
      }
  • Casing: All the responses from our API are in underscore/snake case. The same applies to query and body parameters.

About

Micro-service that links the web app to the results

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages