Certificates
Upload Certificate
POST
https://api.stretch.com/api/v1/storage/certificate
Upload the image only related to coach's certificate as a proof of fitness experience.
Input Fields / Form-Data / JSON
Query Parameter
Type
Description
Example
file required
string (binary)
title
string
description
string
issue_date
Code sample
cURL Python PHP Java Ruby Node.js .NET Go Dart
curl -X POST \
--url "https://api.stretch.com/api/v1/storage/certificate" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
headers = {
"Content-Type" : "multipart/form-data" ,
"Authorization" : "Bearer YOUR_ACCESS_TOKEN"
}
try :
response = requests . post ( "https://api.stretch.com/api/v1/storage/certificate, 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/storage/certificate" ;
$headers = array (
"Content-Type: multipart/form-data" ,
"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/storage/certificate" ;
String accessToken = "YOUR_ACCESS_TOKEN" ;
try {
URL apiUrl = new URL ( url );
HttpURLConnection connection = ( HttpURLConnection ) apiUrl . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Content-Type" , "multipart/form-data" );
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/storage/certificate'
access_token = 'YOUR_ACCESS_TOKEN'
uri = URI . parse ( url )
http = Net :: HTTP . new ( uri . host , uri . port )
http . use_ssl = true
headers = {
'Content-Type' => 'multipart/form-data' ,
'Authorization' => "Bearer #{ access_token } "
}
begin
request = Net :: HTTP :: Post . 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/storage/certificate' ;
const headers = {
'Content-Type' : 'multipart/form-data' ,
'Authorization' : 'Bearer YOUR_ACCESS_TOKEN' ,
};
axios
. post ( 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" , "multipart/form-data" ); var response = await client . PostAsync ( new Uri ( "https://api.stretch.com/api/v1/storage/certificate" )
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/storage/certificate"
accessToken := "YOUR_ACCESS_TOKEN"
client := & http . Client {}
req , err := http . NewRequest ( "POST" , url , nil )
if err != nil {
fmt . Println ( "Exception request:" , err )
return
}
req . Header . Add ( "Content-Type" , "multipart/form-data" )
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/storage/certificate' ;
final accessToken = 'YOUR_ACCESS_TOKEN' ;
final headers = {
'Content-Type' : 'multipart/form-data' ,
'Authorization' : 'Bearer $ accessToken ' ,
};
try { final response = await http . post ( 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
Successful Response (201) Validation Error (422)
FileBase
{
"title" : "string" ,
"description" : "string" ,
"contentType" : "string" ,
"id" : "3bfb4898-2ee6-4102-b860-1175968abc1a" ,
"originFilename" : "string" ,
"url" : "string" ,
"thumb" : "string" ,
"filesize" : 1234 ,
"status" : "approved" ,
"issueDate" : "string" ,
"expireDate" : "string"
}
List Certificates
GET
https://api.stretch.com/api/v1/storage/certificates
List all the certificates uploaded by the coach
Code sample
cURL Python PHP Java Ruby Node.js .NET Go Dart
curl -X GET \
--url "https://api.stretch.com/api/v1/storage/certificates" \
-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/storage/certificates, 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/storage/certificates" ;
$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/storage/certificates" ;
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/storage/certificates'
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/storage/certificates' ;
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/storage/certificates" )
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/storage/certificates"
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/storage/certificates' ;
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
Successful Response (200)
FileBase
[{
"title" : "string" ,
"description" : "string" ,
"contentType" : "string" ,
"id" : "43aca174-675e-4608-90f9-035ca57e39e2" ,
"originFilename" : "string" ,
"url" : "string" ,
"thumb" : "string" ,
"filesize" : 1234 ,
"status" : "approved" ,
"issueDate" : "string" ,
"expireDate" : "string"
},{
"title" : "string" ,
"description" : "string" ,
"contentType" : "string" ,
"id" : "80643a68-539c-4e40-b924-7888357318c1" ,
"originFilename" : "string" ,
"url" : "string" ,
"thumb" : "string" ,
"filesize" : 1234 ,
"status" : "approved" ,
"issueDate" : "string" ,
"expireDate" : "string"
}]
Update Certificate
PUT
https://api.stretch.com/api/v1/storage/certificate/{certificate_id}
Update the certificate by adding the newly inserted image and replacing the previous image file simultaneously.
Input Fields / Form-Data / JSON
Query Parameter
Type
Description
Example
file
string (binary)
title
string
description
string
issue_date
Code sample
cURL Python PHP Java Ruby Node.js .NET Go Dart
curl -X PUT \
--url "https://api.stretch.com/api/v1/storage/certificate/{certificate_id}" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
headers = {
"Content-Type" : "multipart/form-data" ,
"Authorization" : "Bearer YOUR_ACCESS_TOKEN"
}
try :
response = requests . put ( "https://api.stretch.com/api/v1/storage/certificate/ {certificate_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/storage/certificate/{certificate_id}" ;
$headers = array (
"Content-Type: multipart/form-data" ,
"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/storage/certificate/{certificate_id}" ;
String accessToken = "YOUR_ACCESS_TOKEN" ;
try {
URL apiUrl = new URL ( url );
HttpURLConnection connection = ( HttpURLConnection ) apiUrl . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Content-Type" , "multipart/form-data" );
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/storage/certificate/{certificate_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' => 'multipart/form-data' ,
'Authorization' => "Bearer #{ access_token } "
}
begin
request = Net :: HTTP :: Put . 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/storage/certificate/{certificate_id}' ;
const headers = {
'Content-Type' : 'multipart/form-data' ,
'Authorization' : 'Bearer YOUR_ACCESS_TOKEN' ,
};
axios
. put ( 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" , "multipart/form-data" ); var response = await client . PutAsync ( new Uri ( "https://api.stretch.com/api/v1/storage/certificate/{certificate_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/storage/certificate/{certificate_id}"
accessToken := "YOUR_ACCESS_TOKEN"
client := & http . Client {}
req , err := http . NewRequest ( "PUT" , url , nil )
if err != nil {
fmt . Println ( "Exception request:" , err )
return
}
req . Header . Add ( "Content-Type" , "multipart/form-data" )
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/storage/certificate/{certificate_id}' ;
final accessToken = 'YOUR_ACCESS_TOKEN' ;
final headers = {
'Content-Type' : 'multipart/form-data' ,
'Authorization' : 'Bearer $ accessToken ' ,
};
try { final response = await http . put ( 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
Delete Certificate
DELETE
https://api.stretch.com/api/v1/storage/certificate/{certificate_id}
Delete the certificate using the certificate id and coach's authentication is required in order
to complete this process.
Code sample
cURL Python PHP Java Ruby Node.js .NET Go Dart
curl -X DELETE \
--url "https://api.stretch.com/api/v1/storage/certificate/{certificate_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/storage/certificate/ {certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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/storage/certificate/{certificate_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
Set Certificates Order
PUT
https://api.stretch.com/api/v1/storage/certificates/order
user
Changes the order of files in the user's gallery.
The list must contain the ID of all available files,
obtained using the [GET] List Images request.
Input Fields / Form-Data / JSON
Query Parameter
Type
Description
Example
order
array
List of IDs in the required order
Code sample
cURL Python PHP Java Ruby Node.js .NET Go Dart
curl -X PUT \
--url "https://api.stretch.com/api/v1/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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/storage/certificates/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