REST API
Project

Project Operations

The SDK provides several methods to interact with projects.

Project Object

When working with project-related methods, you'll be using the Project object which has the following properties:

OptionTypeDescription
idStringThe unique identifier of the project.
nameStringThe name of the project.
descriptionStringThe description of the project.
created_atDateThe timestamp when the project was created.

Get All Projects

Retrieves a list of all projects. The method returns an array of Project objects.

Using async await syntax:

import { getProjects } from '@qubitro/client';
 
async function fetchProjects() {
    try {
        const projects = await getProjects();
        console.log(projects);
    } catch (err) {
        console.error(`Error ${err.status}: ${err.message}`);
    }
}
 
fetchProjects();

or promises:

import { getProjects } from '@qubitro/client';
 
getProjects()
    .then(projects => {
        console.log(projects);
    })
    .catch(err => {
        console.error(`Error ${err.status}: ${err.message}`);
    });

Example Response

[
    {
        "id": "project-id",
        "name": "project-name",
        "description": "project-description",
        "created_at": "creation-date"
    },
    // ...
]

Get Project by ID

Retrieves a specific project by its ID. The method returns a Project object.

Parameters:

OptionTypeDescription
projectIDStringThe unique identifier of the project.

Using async await syntax:

import { getProjectById } from '@qubitro/client';
 
const projectId = 'your-project-id';
 
async function fetchProject() {
    try {
        const project = await getProjectById(projectId);
        console.log(`Project ID: ${project.id}`);
        console.log(`Project Name: ${project.name}`);
        console.log(`Project Description: ${project.description}`);
        console.log(`Project Created At: ${project.created_at}`);
    } catch (err) {
        console.error(`Error ${err.status}: ${err.message}`);
    }
}
 
fetchProject();

or promises:

import { getProjectById } from '@qubitro/client';
 
const projectId = 'your-project-id';
 
getProjectById(projectId)
    .then(project => {
        console.log(`Project ID: ${project.id}`);
        console.log(`Project Name: ${project.name}`);
        console.log(`Project Description: ${project.description}`);
        console.log(`Project Created At: ${project.created_at}`);
    })
    .catch(err => {
        console.error(`Error ${err.status}: ${err.message}`);
    });

Example Response

{
  "id": "project1",
  "name": "My First Project",
  "description": "This is my first project.",
  "created_at": "2023-01-01T00:00:00Z"
}

logo

Start building today

Collect, process, and activate device data. Scale from one device to thousands.

Qubitro Logo

Product

Resources

Industries

Decision Aids

Solutions

Company

© 2024 Qubitro, Inc. All rights reserved