Skip to content

Services

Get Service Types

GET https://api.stretch.com/api/v1/servicetypes

Gets the type of service or the category of a chosen service.

Code sample

curl -X GET \
  --url "https://api.stretch.com/api/v1/servicetypes" \
  -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/servicetypes, 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/servicetypes";
$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/servicetypes";
        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/servicetypes'
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/servicetypes';
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/servicetypes")

    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/servicetypes"
    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/servicetypes';
  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

ServiceType

    [{
        "name": "string",
        "description": "string"
    },{
        "name": "string",
        "description": "string"
    }]

Get Coach Services

GET https://api.stretch.com/api/v1/coach/services

Gets a list of all the service sessions and all the coaches currently offering it.

Code sample

curl -X GET \
  --url "https://api.stretch.com/api/v1/coach/services" \
  -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/services, 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/services";
$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/services";
        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/services'
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/services';
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/services")

    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/services"
    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/services';
  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

Service

    [{
        "id": "ecd0b812-5e77-4020-b9f3-9f26f4a45dfe",
        "name": "string",
        "description": "string",
        "promo": False,
        "price": 55.12,
        "priceCurrency": "USD",
        "serviceOtherType": "string",
        "sessionMinutesDuration": 60,
        "sessionCancellationHours": 24,
        "status": "review",
        "serviceTypes": [],
        "numberOfSessions": 1234,
        "expiresInDays": 1234,
        "groupSession": False,
        "maxGroupSize": 1234,
        "slots": []
    },{
        "id": "946993c4-bc6f-4ac0-b9a4-c980eb24ae85",
        "name": "string",
        "description": "string",
        "promo": False,
        "price": 55.12,
        "priceCurrency": "USD",
        "serviceOtherType": "string",
        "sessionMinutesDuration": 60,
        "sessionCancellationHours": 24,
        "status": "review",
        "serviceTypes": [],
        "numberOfSessions": 1234,
        "expiresInDays": 1234,
        "groupSession": False,
        "maxGroupSize": 1234,
        "slots": []
    }]

HTTPValidationError

{
    "detail": []
}

Set Coach Services Order

PUT https://api.stretch.com/api/v1/coach/services/order

Updates the coach service by organising in order chosen by the user for better organising and management.

Input Fields / Form-Data / JSON

Query Parameter Type Description Example
order array

Code sample

curl -X PUT \
  --url "https://api.stretch.com/api/v1/coach/services/order" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"\
  -d '{
        "order": []
    }'
import requests

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

try:
    payload = {
        "order": []
    }
    response = requests.put("https://api.stretch.com/api/v1/coach/services/order", headers=headers, json=payload)
    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/services/order";
$headers = array(
    "Content-Type: application/json",
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
);


$payload = array(
    {
        "order": []
    }
);

$data_string = json_encode($payload);

$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);curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$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;
import java.io.OutputStream;

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

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

            connection.setDoOutput(true);
            OutputStream outputStream = connection.getOutputStream();
            outputStream.write(payload.getBytes("UTF-8"));
            outputStream.flush();
            outputStream.close();

            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/services/order'
access_token = 'YOUR_ACCESS_TOKEN'
payload = {
        "order": []
    }.to_json

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::Put.new(uri.request_uri, headers)
  request.body = payload
  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/services/order';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
};

const payload = {
        "order": []
    };

axios
  .put(url, payload, { 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;
using System.Text;
using System.Threading.Tasks;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");

    var payload = {
        "order": []
    }
    var content = new StringContent(payload, Encoding.UTF8, "application/json");
    var response = await client.PutAsync(new Uri("https://api.stretch.com/api/v1/coach/services/order"), content);


    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"
    "bytes"
    "encoding/json"
)

func main() {
    url := "https://api.stretch.com/api/v1/coach/services/order"
    accessToken := "YOUR_ACCESS_TOKEN"

    client := &http.Client{}
    payload := map[string]string{
        "order": []
    }
    jsonPayload, err := json.Marshal(payload)

    req, err := http.NewRequest("PUT", url, bytes.NewBuffer(jsonPayload))

    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/services/order';
  final accessToken = 'YOUR_ACCESS_TOKEN';

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

  final payload = jsonEncode(application/json);

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

ServiceOrderIn

{
    "order": []
}

ErrorResponse

{
    "code": 404
    "error": "coach_service_not_found"
    "message": "Coach service not found"
}

ErrorResponse:

error string

message string

code integer

HTTPValidationError

{
    "detail": []
}

Create Coach Service

POST https://api.stretch.com/api/v1/coach/service

Creates a service dedicated to a coach.

Input Fields / Form-Data / JSON

Query Parameter Type Description Example
name required string My first stretching session
description string My session description
serviceTypes required array ['Static Stretching', 'Active Stretching', 'My Private Stretching']
serviceOtherType string
numberOfSessions integer default: _1_ Session count in this package
1
expiresInDays integer default: _14_ Session day availability in this service
14
sessionCancellationHours integer default: _24_ Session cancellation time before cancel
24
sessionMinutesDuration integer default: _60_ Session duration
60
promo boolean
price required number 199.9
priceCurrency required AED
groupSession boolean True
maxGroupSize integer 10
slots array

Code sample

curl -X POST \
  --url "https://api.stretch.com/api/v1/coach/service" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"\
  -d '{
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }'
import requests

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

try:
    payload = {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    response = requests.post("https://api.stretch.com/api/v1/coach/service", headers=headers, json=payload)
    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/service";
$headers = array(
    "Content-Type: application/json",
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
);


$payload = array(
    {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
);

$data_string = json_encode($payload);

$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);curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$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;
import java.io.OutputStream;

public class Main {
    public static void main(String[] args) {
        String url = "https://api.stretch.com/api/v1/coach/service";
        String accessToken = "YOUR_ACCESS_TOKEN";
        String payload = {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    };

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

            connection.setDoOutput(true);
            OutputStream outputStream = connection.getOutputStream();
            outputStream.write(payload.getBytes("UTF-8"));
            outputStream.flush();
            outputStream.close();

            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/service'
access_token = 'YOUR_ACCESS_TOKEN'
payload = {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }.to_json

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::Post.new(uri.request_uri, headers)
  request.body = payload
  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/service';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
};

const payload = {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    };

axios
  .post(url, payload, { 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;
using System.Text;
using System.Threading.Tasks;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");

    var payload = {
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    var content = new StringContent(payload, Encoding.UTF8, "application/json");
    var response = await client.PostAsync(new Uri("https://api.stretch.com/api/v1/coach/service"), content);


    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"
    "bytes"
    "encoding/json"
)

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

    client := &http.Client{}
    payload := map[string]string{
        "name": "My first stretching session",
        "description": "My session description",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": False,
        "price": 199.9,
        "priceCurrency": "AED",
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    jsonPayload, err := json.Marshal(payload)

    req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))

    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/service';
  final accessToken = 'YOUR_ACCESS_TOKEN';

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

  final payload = jsonEncode(application/json);

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

Service

{
    "id": "acb7b974-26dd-4c4c-a670-e3c27deabe87",
    "name": "string",
    "description": "string",
    "promo": False,
    "price": 55.12,
    "priceCurrency": "USD",
    "serviceOtherType": "string",
    "sessionMinutesDuration": 60,
    "sessionCancellationHours": 24,
    "status": "review",
    "serviceTypes": [],
    "numberOfSessions": 1234,
    "expiresInDays": 1234,
    "groupSession": False,
    "maxGroupSize": 1234,
    "slots": []
}

HTTPValidationError

{
    "detail": []
}

Get Coach Service

GET https://api.stretch.com/api/v1/coach/service/{service_id}

Gets the services offered by the specified coach by passing the service id as a parameter.

Code sample

curl -X GET \
  --url "https://api.stretch.com/api/v1/coach/service/{service_id}" \
  -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/service/{service_id}, 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/service/{service_id}";
$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/service/{service_id}";
        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/service/{service_id}'
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/service/{service_id}';
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/service/{service_id}")

    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/service/{service_id}"
    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/service/{service_id}';
  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

Service

{
    "id": "fdf44694-fdc4-4287-9338-3901bf006ec6",
    "name": "string",
    "description": "string",
    "promo": False,
    "price": 55.12,
    "priceCurrency": "USD",
    "serviceOtherType": "string",
    "sessionMinutesDuration": 60,
    "sessionCancellationHours": 24,
    "status": "review",
    "serviceTypes": [],
    "numberOfSessions": 1234,
    "expiresInDays": 1234,
    "groupSession": False,
    "maxGroupSize": 1234,
    "slots": []
}

ErrorResponse

{
    "code": 404
    "error": "coach_service_not_found"
    "message": "Coach service not found"
}

ErrorResponse:

error string

message string

code integer

HTTPValidationError

{
    "detail": []
}

Update Coach Service

PUT https://api.stretch.com/api/v1/coach/service/{service_id}

Updates the coaches information about their offered services and displays the complete change of their details.

Input Fields / Form-Data / JSON

Query Parameter Type Description Example
name string Update name first session
description string Update description of session
serviceTypes array ['Active Stretching', 'Static Stretching']
serviceOtherType string
numberOfSessions integer default: _1_ Session count in this package
1
expiresInDays integer 14
sessionCancellationHours integer default: _24_ Session cancellation time before cancel
24
sessionMinutesDuration integer 60
promo boolean Update promo of session
price number 200.5
priceCurrency
groupSession boolean True
maxGroupSize integer 10
slots array

Code sample

curl -X PUT \
  --url "https://api.stretch.com/api/v1/coach/service/{service_id}" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"\
  -d '{
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }'
import requests

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

try:
    payload = {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    response = requests.put("https://api.stretch.com/api/v1/coach/service/{service_id}", headers=headers, json=payload)
    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/service/{service_id}";
$headers = array(
    "Content-Type: application/json",
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
);


$payload = array(
    {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
);

$data_string = json_encode($payload);

$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);curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$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;
import java.io.OutputStream;

public class Main {
    public static void main(String[] args) {
        String url = "https://api.stretch.com/api/v1/coach/service/{service_id}";
        String accessToken = "YOUR_ACCESS_TOKEN";
        String payload = {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    };

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

            connection.setDoOutput(true);
            OutputStream outputStream = connection.getOutputStream();
            outputStream.write(payload.getBytes("UTF-8"));
            outputStream.flush();
            outputStream.close();

            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/service/{service_id}'
access_token = 'YOUR_ACCESS_TOKEN'
payload = {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }.to_json

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::Put.new(uri.request_uri, headers)
  request.body = payload
  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/service/{service_id}';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
};

const payload = {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    };

axios
  .put(url, payload, { 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;
using System.Text;
using System.Threading.Tasks;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");

    var payload = {
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    var content = new StringContent(payload, Encoding.UTF8, "application/json");
    var response = await client.PutAsync(new Uri("https://api.stretch.com/api/v1/coach/service/{service_id}"), content);


    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"
    "bytes"
    "encoding/json"
)

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

    client := &http.Client{}
    payload := map[string]string{
        "name": "Update name first session",
        "description": "Update description of session",
        "serviceTypes": [],
        "serviceOtherType": "string",
        "numberOfSessions": 1,
        "expiresInDays": 14,
        "sessionCancellationHours": 24,
        "sessionMinutesDuration": 60,
        "promo": Update promo of session,
        "price": 200.5,
        "groupSession": True,
        "maxGroupSize": 10,
        "slots": []
    }
    jsonPayload, err := json.Marshal(payload)

    req, err := http.NewRequest("PUT", url, bytes.NewBuffer(jsonPayload))

    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/service/{service_id}';
  final accessToken = 'YOUR_ACCESS_TOKEN';

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

  final payload = jsonEncode(application/json);

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

Service

{
    "id": "61206675-a97d-40d4-8362-b764bca2b1f0",
    "name": "string",
    "description": "string",
    "promo": False,
    "price": 55.12,
    "priceCurrency": "USD",
    "serviceOtherType": "string",
    "sessionMinutesDuration": 60,
    "sessionCancellationHours": 24,
    "status": "review",
    "serviceTypes": [],
    "numberOfSessions": 1234,
    "expiresInDays": 1234,
    "groupSession": False,
    "maxGroupSize": 1234,
    "slots": []
}

ErrorResponse

{
    "code": 404
    "error": "coach_service_not_found"
    "message": "Coach service not found"
}

ErrorResponse:

error string

message string

code integer

HTTPValidationError

{
    "detail": []
}

Delete Coach Service

DELETE https://api.stretch.com/api/v1/coach/service/{service_id}

Deletes one of the services being offered by the specified coach by using coach id as reference.

Code sample

curl -X DELETE \
  --url "https://api.stretch.com/api/v1/coach/service/{service_id}" \
  -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.delete("https://api.stretch.com/api/v1/coach/service/{service_id}, 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/service/{service_id}";
$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/service/{service_id}";
        String accessToken = "YOUR_ACCESS_TOKEN";

        try {
            URL apiUrl = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
            connection.setRequestMethod("DELETE");
            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/service/{service_id}'
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::Delete.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/service/{service_id}';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
};

axios
  .delete(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.DeleteAsync(new Uri("https://api.stretch.com/api/v1/coach/service/{service_id}")

    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/service/{service_id}"
    accessToken := "YOUR_ACCESS_TOKEN"

    client := &http.Client{}
    req, err := http.NewRequest("DELETE", 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/service/{service_id}';
  final accessToken = 'YOUR_ACCESS_TOKEN';

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

  try {final response = await http.delete(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

ErrorResponse

{
    "code": 404
    "error": "coach_service_not_found"
    "message": "Coach service not found"
}

ErrorResponse:

error string

message string

code integer

HTTPValidationError

{
    "detail": []
}