cURL
curl --request POST \
--url https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"near_account_id": "<string>",
"phase": "prepare"
}
'import requests
url = "https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind"
payload = {
"near_account_id": "<string>",
"phase": "prepare"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({near_account_id: '<string>', phase: 'prepare'})
};
fetch('https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind', 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://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'near_account_id' => '<string>',
'phase' => 'prepare'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind"
payload := strings.NewReader("{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}"
response = http.request(request)
puts response.read_body{
"actor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"binding_terms_version": "<string>",
"challenge_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contract_id": "<string>",
"credit_nano_usd_per_reward_unit": 123,
"expires_at": "2023-11-07T05:31:56Z",
"farm_product_id": "<string>",
"near_account_id": "<string>",
"network_id": "<string>",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payload": {
"message": "<string>",
"nonce": [
1
],
"recipient": "<string>"
},
"phase": "<string>",
"farm_price_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Staking Farm
Post v1organizations stakingfarmbind
deprecated
Deprecated: this endpoint is moving to cloud-platform at the same path; the cloud-platform base URL will be announced. Behaviour may differ in edge cases.
POST
/
v1
/
organizations
/
{org_id}
/
staking
/
farm
/
bind
cURL
curl --request POST \
--url https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"near_account_id": "<string>",
"phase": "prepare"
}
'import requests
url = "https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind"
payload = {
"near_account_id": "<string>",
"phase": "prepare"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({near_account_id: '<string>', phase: 'prepare'})
};
fetch('https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind', 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://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'near_account_id' => '<string>',
'phase' => 'prepare'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind"
payload := strings.NewReader("{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/organizations/{org_id}/staking/farm/bind")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"near_account_id\": \"<string>\",\n \"phase\": \"prepare\"\n}"
response = http.request(request)
puts response.read_body{
"actor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"binding_terms_version": "<string>",
"challenge_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contract_id": "<string>",
"credit_nano_usd_per_reward_unit": 123,
"expires_at": "2023-11-07T05:31:56Z",
"farm_product_id": "<string>",
"near_account_id": "<string>",
"network_id": "<string>",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payload": {
"message": "<string>",
"nonce": [
1
],
"recipient": "<string>"
},
"phase": "<string>",
"farm_price_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Body
application/json
Response
- Option 1
- Option 2