API Documentation

Complete guide to SSU Methods Transfer Analysis API

Version 1.0
# Get unique transfer circles
curl -X GET "http://service.ssumethods.com/api/all-getUniqueCircles" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json"

# Example with actual token
curl -X GET "http://service.ssumethods.com/api/all-getUniqueCircles" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \
  -H "Content-Type: application/json"
// Using fetch API
const getUniqueCircles = async () => {
  try {
    const response = await fetch('http://service.ssumethods.com/api/all-getUniqueCircles', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json'
      }
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();
    console.log('Unique circles:', data);
    return data;
  } catch (error) {
    console.error('Error fetching unique circles:', error);
    throw error;
  }
};

// Using axios (alternative)
const axios = require('axios');

const getCircles = async () => {
  try {
    const response = await axios.get('http://service.ssumethods.com/api/all-getUniqueCircles', {
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN',
        'Content-Type': 'application/json'
      }
    });
    
    return response.data;
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
    throw error;
  }
};

// Call the function
getUniqueCircles();
import requests
import json
from typing import Dict, Any

class TransferAPI:
    def __init__(self, base_url: str, api_token: str):
        self.base_url = base_url
        self.headers = {
            'Authorization': f'Bearer {api_token}',
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        }
    
    def get_unique_circles(self) -> Dict[str, Any]:
        """Retrieve unique transfer circles"""
        try:
            response = requests.get(
                f'{self.base_url}/api/all-getUniqueCircles',
                headers=self.headers,
                timeout=30
            )
            response.raise_for_status()
            return response.json()
        
        except requests.exceptions.RequestException as e:
            print(f"Error fetching unique circles: {e}")
            raise

# Usage example
api = TransferAPI(
    base_url='http://service.ssumethods.com',
    api_token='YOUR_API_TOKEN'
)

try:
    circles_data = api.get_unique_circles()
    print("Success!")
    print(f"Found {len(circles_data.get('data', {}).get('uniqueCircles', []))} unique circles")
    
    # Process the circles
    for circle in circles_data.get('data', {}).get('uniqueCircles', []):
        print(f"Circle ID: {circle['id']}, Length: {circle['length']}")
        
except Exception as e:
    print(f"Failed to retrieve unique circles: {e}")
<?php

class TransferAPI {
    private $baseUrl;
    private $apiToken;
    
    public function __construct($baseUrl, $apiToken) {
        $this->baseUrl = rtrim($baseUrl, '/');
        $this->apiToken = $apiToken;
    }
    
    public function getUniqueCircles() {
        $url = $this->baseUrl . '/api/all-getUniqueCircles';
        
        $headers = [
            'Authorization: Bearer ' . $this->apiToken,
            'Content-Type: application/json',
            'Accept: application/json'
        ];
        
        $ch = curl_init();
        curl_setopt_array($ch, [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_SSL_VERIFYPEER => false
        ]);
        
        $response = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $error = curl_error($ch);
        curl_close($ch);
        
        if ($error) {
            throw new Exception("cURL Error: " . $error);
        }
        
        if ($httpCode !== 200) {
            throw new Exception("HTTP Error: " . $httpCode);
        }
        
        return json_decode($response, true);
    }
}

// Usage example
try {
    $api = new TransferAPI(
        'http://service.ssumethods.com',
        'YOUR_API_TOKEN'
    );
    
    $circlesData = $api->getUniqueCircles();
    
    echo "Success!\n";
    echo "Found " . count($circlesData['data']['uniqueCircles']) . " unique circles\n";
    
    foreach ($circlesData['data']['uniqueCircles'] as $circle) {
        echo "Circle ID: {$circle['id']}, Length: {$circle['length']}\n";
    }
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}

?>
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.JsonNode;

public class TransferAPI {
    private final String baseUrl;
    private final String apiToken;
    private final HttpClient httpClient;
    private final ObjectMapper objectMapper;
    
    public TransferAPI(String baseUrl, String apiToken) {
        this.baseUrl = baseUrl.replaceAll("/$", "");
        this.apiToken = apiToken;
        this.httpClient = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(30))
            .build();
        this.objectMapper = new ObjectMapper();
    }
    
    public JsonNode getUniqueCircles() throws IOException, InterruptedException {
        String url = this.baseUrl + "/api/all-getUniqueCircles";
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer " + this.apiToken)
            .header("Content-Type", "application/json")
            .header("Accept", "application/json")
            .GET()
            .timeout(Duration.ofSeconds(30))
            .build();
        
        HttpResponse<String> response = httpClient.send(
            request, 
            HttpResponse.BodyHandlers.ofString()
        );
        
        if (response.statusCode() != 200) {
            throw new RuntimeException("HTTP Error: " + response.statusCode());
        }
        
        return objectMapper.readTree(response.body());
    }
    
    public static void main(String[] args) {
        try {
            TransferAPI api = new TransferAPI(
                "http://service.ssumethods.com",
                "YOUR_API_TOKEN"
            );
            
            JsonNode circlesData = api.getUniqueCircles();
            
            System.out.println("Success!");
            
            JsonNode circles = circlesData.get("data").get("uniqueCircles");
            System.out.println("Found " + circles.size() + " unique circles");
            
            for (JsonNode circle : circles) {
                System.out.println("Circle ID: " + circle.get("id") + 
                                 ", Length: " + circle.get("length"));
            }
            
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
            e.printStackTrace();
        }
    }
}
package main

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

type TransferAPI struct {
    BaseURL   string
    APIToken  string
    Client    *http.Client
}

type Circle struct {
    ID        int   `json:"id"`
    Circle    []int `json:"circle"`
    Length    int   `json:"length"`
    Frequency int   `json:"frequency"`
    CreatedAt string `json:"created_at"`
}

type CirclesResponse struct {
    Success bool `json:"success"`
    Data    struct {
        UniqueCircles []Circle `json:"uniqueCircles"`
        Total         int      `json:"total"`
    } `json:"data"`
    Message   string `json:"message"`
    Timestamp string `json:"timestamp"`
}

func NewTransferAPI(baseURL, apiToken string) *TransferAPI {
    return &TransferAPI{
        BaseURL:  baseURL,
        APIToken: apiToken,
        Client: &http.Client{
            Timeout: 30 * time.Second,
        },
    }
}

func (api *TransferAPI) GetUniqueCircles() (*CirclesResponse, error) {
    url := api.BaseURL + "/api/all-getUniqueCircles"
    
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        return nil, fmt.Errorf("creating request: %w", err)
    }
    
    req.Header.Set("Authorization", "Bearer "+api.APIToken)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Accept", "application/json")
    
    resp, err := api.Client.Do(req)
    if err != nil {
        return nil, fmt.Errorf("making request: %w", err)
    }
    defer resp.Body.Close()
    
    if resp.StatusCode != http.StatusOK {
        return nil, fmt.Errorf("HTTP error: %d", resp.StatusCode)
    }
    
    body, err := io.ReadAll(resp.Body)
    if err != nil {
        return nil, fmt.Errorf("reading response: %w", err)
    }
    
    var circlesResp CirclesResponse
    if err := json.Unmarshal(body, &circlesResp); err != nil {
        return nil, fmt.Errorf("parsing JSON: %w", err)
    }
    
    return &circlesResp, nil
}

func main() {
    api := NewTransferAPI(
        "http://service.ssumethods.com",
        "YOUR_API_TOKEN",
    )
    
    circlesData, err := api.GetUniqueCircles()
    if err != nil {
        fmt.Printf("Error: %v\n", err)
        return
    }
    
    fmt.Println("Success!")
    fmt.Printf("Found %d unique circles\n", len(circlesData.Data.UniqueCircles))
    
    for _, circle := range circlesData.Data.UniqueCircles {
        fmt.Printf("Circle ID: %d, Length: %d\n", circle.ID, circle.Length)
    }
}