Get a Project

Get a single project

This endpoint will return a single project with the provided Id.

GET https://api.dyntube.com/v1/projects/{id}

Path Parameters

NameTypeDescription

id

String

Project id

Code Samples

C#

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Example
{
    class Program
    {
        private static readonly HttpClient client = new HttpClient();

        static async Task Main(string[] args)
        {
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_bearer_token");

            var projectId = "your_project_id";
            var url = $"https://api.dyntube.com/v1/projects/{projectId}";

            var response = await client.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                var responseContent = await response.Content.ReadAsStringAsync();
                var project = JsonConvert.DeserializeObject<Project>(responseContent);
                Console.WriteLine($"Name: {project.Name}");
                Console.WriteLine($"Description: {project.Description}");
                Console.WriteLine($"Region: {project.Region}");
                // ...
            }
            else
            {
                Console.WriteLine($"Failed to get project {projectId}. Status code: {response.StatusCode}");
            }
        }
    }

    class Project
    {
        public string Id { get; set; }
        public string Key { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public string Region { get; set; }
        // ...
    }
}

Node.js

const axios = require('axios');

const projectId = 'your-project-id';
const bearerToken = 'your-bearer-token';

axios.get(`https://api.dyntube.com/v1/projects/${projectId}`, {
    headers: {
        Authorization: `Bearer ${bearerToken}`
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});

Python

import requests

project_id = "MgLVvAV7"
bearer_token = "your_bearer_token"
remote_server_url = f"https://api.dyntube.com/v1/projects/{project_id}"

headers = {
    "Authorization": f"Bearer {bearer_token}"
}

response = requests.get(remote_server_url, headers=headers)

if response.status_code == 200:
    project = response.json()
    print(f"Project name: {project['name']}")
else:
    print(f"Failed to get project. Status code: {response.status_code}")

PHP

<?php

$projectId = "MgLVvAV7";
$bearerToken = "your_bearer_token";
$url = "https://api.dyntube.com/v1/projects/{$projectId}";

$headers = [
    "Authorization: Bearer {$bearerToken}",
    "Content-Type: application/json",
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($status_code == 200) {
    $project = json_decode($response);
    echo "Project ID: {$project->id}\n";
    echo "Project Name: {$project->name}\n";
    //... other properties
} else {
    echo "Failed to get project. Status code: {$status_code}\n";
}

Last updated