Deepbits Platform: List all projects
This script demonstrates how to list all projects on the Deepbits platform using the GET /projects API endpoint.
Users must authenticate using an API key (x-api-key header) in the request headers. Upon successful request, the API returns a JSON response containing the list of projects under the data field.
Below is a demo script demonstrating how to list all projects. Adjust the placeholder with your specific API key for integration.
import requests
API_KEY = '<Your API key generated from app.deepbits.com>'
API_BASE = 'https://api.deepbits.com/api/v1'
def main():
response = list_projects()
print(response)
def list_projects():
url = f"{API_BASE}/projects"
headers = {
"accept": "application/json",
"x-api-key": API_KEY
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json().get('data', {})
except Exception as e:
print(f"An error occurred: {e}")
return {} # Return an empty dictionary in case of error
if __name__ == "__main__":
main()
Updated 5 months ago