Basic Auth

A guide on how to use Basic Auth for authenticating to our REST APIs.

Overview

Basic Auth is supported in most request libraries and is often as simple as adding a username- and password parameter. To get you up and running quickly, we present a few language-specific methods by fetching a list of projects available from the REST API using a Service Account for access control.

We don't recommend using this authentication flow for production use, the main use for Basic Auth is for quick exploration and experimentation.

Prerequisites

A Service Account must be created in the organization before continuing.

Code Sample

The following examples sends a GET request to list available spaces in your organization. See the API Reference for all available API calls.

import os
import requests  # pip install requests

# Inputs
key_id = '<service account key id>'
sercret = '<service account secret>'

if __name__ == '__main__':
    # Send GET request to endpoint of choice with Basic Auth authentication.
    spaces = requests.get(
        url='https://app.neowit.io/api/space/v1/space',
        auth=(key_id, secret),
    )

    # Print response contents.
    print(spaces.json())

Last updated