Skip to content

Coach profile (client access)

Get Coach Profile

GET https://api.stretch.com/api/v1/coach/{coach_id}/profile

Checks the coach's profile using a unique coach id to call out the function and returns all information regarding their profile.

Code sample

curl -X GET \
  --url "https://api.stretch.com/api/v1/coach/{coach_id}/profile" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}

try:
    response = requests.get("https://api.stretch.com/api/v1/coach/{coach_id}/profile, headers=headers")
    print(response.json())
except requests.exceptions.HTTPError as errh:
    print("HTTP Error:", errh)
except requests.exceptions.RequestException as errex:
    print("Exception request:", errex)
<?php

$url = "https://api.stretch.com/api/v1/coach/{coach_id}/profile";
$headers = array(
    "Content-Type: application/json",
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
);



$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
    echo "Exception request: " . $error_msg;
} else {
    if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
        echo "HTTP Error: " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
    } else {
        echo $response;
    }
}

curl_close($ch);
?>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        String url = "https://api.stretch.com/api/v1/coach/{coach_id}/profile";
        String accessToken = "YOUR_ACCESS_TOKEN";

        try {
            URL apiUrl = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", "Bearer " + accessToken);

            int responseCode = connection.getResponseCode();

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();
                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();
                System.out.println(content.toString());
            } else {
                System.out.println("HTTP Error: " + responseCode);
            }
            connection.disconnect();
        } catch (MalformedURLException e) {
            System.out.println("Exception request: " + e.getMessage());
        } catch (IOException e) {
            System.out.println("Exception request: " + e.getMessage());
        }
    }
}
require 'net/http'
require 'uri'
require 'json'

url = 'https://api.stretch.com/api/v1/coach/{coach_id}/profile'
access_token = 'YOUR_ACCESS_TOKEN'

uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Bearer #{access_token}"
}

begin
  request = Net::HTTP::Get.new(uri.request_uri, headers)
  response = http.request(request)

  if response.code.to_i == 200
    puts JSON.parse(response.body)
  else
    puts "HTTP Error: #{response.code}"
  end
rescue => e
  puts "Exception request: #{e.message}"
end
const axios = require('axios');

const url = 'https://api.stretch.com/api/v1/coach/{coach_id}/profile';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
};

axios
  .get(url,{ headers })
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    if (error.response) {
      console.log('HTTP Error:', error.response.status);
    } else {
      console.log('Exception request:', error.message);
    }
  });
using System;
using System.Net.Http;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");var response = await client.GetAsync(new Uri("https://api.stretch.com/api/v1/coach/{coach_id}/profile")

    if (response.IsSuccessStatusCode) {
      var content = await response.Content.ReadAsStringAsync();
      Console.WriteLine(content);
    } else {
      Console.WriteLine($"Request failed with status code: {(int)response.StatusCode}");
    }
  }
}
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://api.stretch.com/api/v1/coach/{coach_id}/profile"
    accessToken := "YOUR_ACCESS_TOKEN"

    client := &http.Client{}
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Exception request:", err)
        return
    }

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "Bearer "+accessToken)

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Exception request:", err)
        return
    }
    defer resp.Body.Close()

    if resp.StatusCode == http.StatusOK {
        body, err := ioutil.ReadAll(resp.Body)
        if err != nil {
            fmt.Println("Exception request:", err)
            return
        }
        fmt.Println(string(body))
    } else {
        fmt.Println("HTTP Error:", resp.StatusCode)
    }
}
import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
  final url = 'https://api.stretch.com/api/v1/coach/{coach_id}/profile';
  final accessToken = 'YOUR_ACCESS_TOKEN';

  final headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer $accessToken',
  };

  try {final response = await http.get(Uri.parse(url), headers: headers);
    if (response.statusCode == 200) {
      print(jsonDecode(response.body));
    } else {
      print('HTTP Error: ${response.statusCode}');
    }
  } catch (e) {
    print('Exception request: $e');
  }
}
Response

PublicCoachProfileOut

{
    "firstName": "John",
    "lastName": "Smith",
    "phone": "+97100000000",
    "whatsapp": "+97100000000",
    "gender": "male",
    "description": "string",
    "languages": "object",
    "avatarUrl": "string",
    "mediaType": "string",
    "mediaUrl": "string",
    "mediaPreviewUrl": "string",
    "rating": 55.12,
    "serviceTypes": [],
    "services": [],
    "images": [],
    "videos": [],
    "certificates": [],
    "distance": 55.12,
    "experience": 1,
    "price": 55.12,
    "minPrice": 55.12,
    "maxPrice": 55.12,
    "priceCurrency": "string",
    "sessionCount": 1234,
    "verified": False
}

HTTPValidationError

{
    "detail": []
}