Create Follow
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/users/:userId/follow \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/api/v6/:projectId/users/:userId/follow"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/api/v6/:projectId/users/:userId/follow', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/api/v6/:projectId/users/:userId/follow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/api/v6/:projectId/users/:userId/follow"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/api/v6/:projectId/users/:userId/follow")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/users/:userId/follow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"followerId": "<string>",
"followedId": "<string>",
"createdAt": "<string>"
}User Follow Operations
Create Follow
Follow another user
Create Follow
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/users/:userId/follow \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/api/v6/:projectId/users/:userId/follow"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/api/v6/:projectId/users/:userId/follow', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/api/v6/:projectId/users/:userId/follow",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/api/v6/:projectId/users/:userId/follow"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/api/v6/:projectId/users/:userId/follow")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/users/:userId/follow")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"followerId": "<string>",
"followedId": "<string>",
"createdAt": "<string>"
}Create a follow relationship between the authenticated user and another user. This establishes a one-way follow relationship where the authenticated user will follow the specified user.
Path Parameters
Response
Error Responses
Invalid User ID - 400 Bad Request
Invalid User ID - 400 Bad Request
{
"error": "Invalid or missing userId",
"code": "follow/invalid-user-id"
}
Self-Follow Attempt - 400 Bad Request
Self-Follow Attempt - 400 Bad Request
{
"error": "Cannot follow yourself",
"code": "follow/self-follow"
}
User Not Found - 404 Not Found
User Not Found - 404 Not Found
{
"error": "User not found",
"code": "follow/user-not-found"
}
Already Following - 409 Conflict
Already Following - 409 Conflict
{
"error": "Already following this user",
"code": "follow/already-following"
}
Server Error - 500 Internal Server Error
Server Error - 500 Internal Server Error
{
"error": "Internal server error",
"code": "follow/server-error"
}
Notes
- This endpoint creates a
Followrelationship in the database - Follows are one-way relationships that do not require approval
- Users cannot follow themselves
- Duplicate follow requests return a 409 status
- Rate limiting: 75 requests per 5 minutes

