note

URL (API endpoint)

Request URL
https://tmproxy.com/api/proxy/note

Request body

api_key 是您从 TMProxy 购买的 API 密钥

Example Value
{
  "api_key": "API_KEY",
  "note": "需要记录的信息"
}
Schema
responseNote{
  code    integer
  message string
}


Server response OK

Response body - code 200
{
  "code": 0,
  "message": "string"
}

Example Code

JavaScript (fetch API)
fetch('https://tmproxy.com/api/proxy/note', {
    method: 'POST',
    headers: {
      'accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "api_key": "API_KEY",
      "note": "string"
    })
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));
Python (requests library)
import requests

url = "https://tmproxy.com/api/proxy/note"
headers = {
  "accept": "application/json",
  "Content-Type": "application/json"
}
data = {
  "api_key": "API_KEY",
  "note": "string"
}

response = requests.post(url, headers=headers, json=data)
print(response.text)
Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://tmproxy.com/api/proxy/note"
	data := map[string]string{
		"api_key": "API_KEY",
		"note":    "YOUR_NOTE",
	}
	jsonData, err := json.Marshal(data)
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
	if err != nil {
		panic(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println("response Status:", resp.Status)

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println("response Body:", string(body))
}
Curl
curl -X POST "https://tmproxy.com/api/proxy/note" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"api_key\":\"API_KEY\",\"note\":\"YOUR_NOTE\"}"
PHP (cURL)
<?php
// PHP (cURL)
$url = "https://tmproxy.com/api/proxy/note";
$data = array(
  "api_key" => "API_KEY", 
  "note" => "YOUR_NOTE" 
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'accept: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

echo $response . "\n";

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch) . "\n";
}
curl_close($ch);
?>
Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) throws IOException {
        String apiKey = "API_KEY"; //
        String note = "YOUR_NOTE";      
        URL url = new URL("https://tmproxy.com/api/proxy/note");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type", "application/json; utf-8");
        connection.setRequestProperty("Accept", "application/json");
        connection.setDoOutput(true); 

        String jsonInputString = String.format("{\"api_key\": \"%s\", \"note\": \"%s\"}", apiKey, note);

        try (OutputStream os = connection.getOutputStream()) {
            byte[] input = jsonInputString.getBytes("utf-8");
            os.write(input, 0, input.length);
        }

        int responseCode = connection.getResponseCode();
        System.out.println("Response Code: " + responseCode);

        try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"))) {
            StringBuilder response = new StringBuilder();
            String responseLine = null;
            while ((responseLine = br.readLine()) != null) {
                response.append(responseLine.trim());
            }
            System.out.println("Response Body: " + response.toString());
        }
        connection.disconnect();
    }
}
C#
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

public class Program
{
    public static async Task Main(string[] args)
    {
        using (var client = new HttpClient())
        {
            var url = "https://tmproxy.com/api/proxy/note";
            var data = new { api_key = "API_KEY", note = "YOUR_NOTE" }; // Thay YOUR_ACTUAL_NOTE bằng nội dung note
            var json = JsonSerializer.Serialize(data);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            var response = await client.PostAsync(url, content);
            var responseString = await response.Content.ReadAsStringAsync();

            Console.WriteLine(responseString);
        }
    }
}