Fetch Projects

Description

Get all your public projects.

Endpoint

/api/v1/projects

Method

GET

Headers

Our API expects `Authorization` header to be provided

// Don't forget to provide `Authorization` header
'Authorization': `Bearer ${YOUR_API_KEY}`,

Usage

// don't forget to get your API key
const YOUR_API_KEY = 'Replace with your API key' // or from env file

// get all your public project
fetch('https://api.projectshub.dev/api/v1/projects', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${YOUR_API_KEY}`,
  }
})
  .then((response) => response.json())
  .then((data) => console.log(data));

Response Data

You get this response data if your request was successful.

// success response
{
  success: true,
  error: null,
  results: {
    data: {
      projects: [], //...your projects
      projectsCount: 10, // the total number of projects returned
    },
    meta: {
      totalProjects: 20, // total project you have
      page: 1, // current page
      limit: 10, // the limit,
      totalPages: 2 // total pages available.
    }
  }
}

See our API response data format

Last updated