SDK 및 라이브러리
FourA는 REST API입니다. HTTP를 지원하는 모든 언어에서 사용할 수 있습니다. 가장 인기 있는 언어로 작성된 빠른 시작 예제는 다음과 같습니다.
Python
requests 라이브러리 사용 예시:
import requests
response = requests.post(
"https://eu.api.foura.ai/api/single/",
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"method": "GET",
"url": "https://example.com"
}
)
data = response.json()
print(data["data"][:200]) # First 200 chars of response body
Node.js
내장된 fetch 사용 예시 (Node 18+):
const response = await fetch('https://eu.api.foura.ai/api/single/', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
method: 'GET',
url: 'https://example.com'
})
});
const result = await response.json();
console.log(result.data.slice(0, 200));
cURL
명령줄에서 테스트하는 가장 간단한 방법:
curl -X POST https://eu.api.foura.ai/api/single/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"method": "GET", "url": "https://example.com"}'
Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]string{
"method": "GET",
"url": "https://example.com",
})
req, _ := http.NewRequest("POST", "https://eu.api.foura.ai/api/single/", bytes.NewBuffer(payload))
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Ruby
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://eu.api.foura.ai/api/single/')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { method: 'GET', url: 'https://example.com' }.to_json
response = http.request(request)
puts JSON.parse(response.body)['data'][0..200]
공식 SDK
Python 및 Node.js용 공식 SDK를 개발 중입니다. 조기 액세스를 신청하려면 베타 대기자 명단에 등록하세요.
다음 단계
- 빠른 시작: 첫 번째 request
- 인증: API key 발급받기
- API Endpoints: 전체 레퍼런스