cURL JavaScript Python Go Ruby PHP Java
curl -X PUT 'https://your-hatch-server/api/workspaces/{workspace}/stream' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"url": "string"
}' const res = await fetch ("https://your-hatch-server/api/workspaces/{workspace}/stream" , {
method : "PUT" ,
headers : {
Authorization : "Bearer <token>" ,
"Content-Type" : "application/json" ,
},
body : JSON.stringify ({
"url" : "string"
}),
})
const data = await res.json ()import requests
res = requests.request ("PUT" , "https://your-hatch-server/api/workspaces/{workspace}/stream" , headers={"Authorization" : "Bearer <token>" , "Content-Type" : "application/json" }, json={
"url" : "string" ,
})
data = res.json ()package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main () {
body := strings.NewReader (`{
"url": "string"
}` )
req, err := http.NewRequest ("PUT" , "https://your-hatch-server/api/workspaces/{workspace}/stream" , body)
if err != nil {
panic (err)
}
req.Header .Set ("Authorization" , "Bearer <token>" )
req.Header .Set ("Content-Type" , "application/json" )
res, err := http.DefaultClient .Do (req)
if err != nil {
panic (err)
}
defer res.Body .Close ()
data, _ := io.ReadAll (res.Body )
fmt.Println (string (data))
}require "net/http"
require "json"
uri = URI ('https://your-hatch-server/api/workspaces/{workspace}/stream' )
req = Net ::HTTP ::Put .new (uri)
req['Authorization' ] = 'Bearer <token>'
req['Content-Type' ] = 'application/json'
req.body = JSON.generate ({
'url' => 'string'
})
res = Net ::HTTP .start (uri.hostname , uri.port , use_ssl: uri.scheme == "https" ) do |http|
http.request (req)
end
puts res.body <?php
$ch = curl_init('https://your-hatch-server/api/workspaces/{workspace}/stream');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"url": "string"
}',
]);
$response = curl_exec($ch);
echo $response;import java.net .URI ;
import java.net .http .HttpClient ;
import java.net .http .HttpRequest ;
import java.net .http .HttpResponse ;
HttpClient client = HttpClient .newHttpClient ();
HttpRequest request = HttpRequest .newBuilder ()
.uri (URI.create ("https://your-hatch-server/api/workspaces/{workspace}/stream" ))
.header ("Authorization" , "Bearer <token>" )
.header ("Content-Type" , "application/json" )
.method ("PUT" , HttpRequest .BodyPublishers .ofString ("{\"url\":\"string\"}" ))
.build ();
HttpResponse <String > response = client.send (request, HttpResponse .BodyHandlers .ofString ());
System .out .println (response.body ());
200 4XX
{
"stream" : {
"url" : "string" ,
"createdAt" : 0 ,
"lastSentAt" : 0 ,
"lastError" : "string" ,
"paused" : true
},
"secret" : "string"
}{
"message" : "string" ,
"code" : "string" ,
"retryable" : true ,
"requestId" : "string"
}