API Reference

To perform a deposit to an agent, that agent’s customer guid is required. To retrieve the guid of a SPENN agent of the same currency, use the following API.

Description

Headers

  • Content-Type: The Content-Type header is set to application/json, indicating that the request body contains JSON data.
  • Authorization: The Authorization header is used with a bearer token for authentication. The actual token value should replace the placeholder Bearer eyJhbG...NrEQ41w.

Sample Request:

import requests

def get_agent_data(agent_number, token):
    # URL with the agent number included in the query parameters
    url = f"https://uat-businessapi.spenn.com/api/Partner/GetAgent?agentNumber={agent_number}"

    # Headers with the Authorization token
    headers = {
        'Authorization': f'Bearer {token}'
    }

    # Sending the GET request
    try:
        response = requests.get(url, headers=headers)
        # Return the response data (or handle it as needed)
        return response.json()
    except requests.RequestException as e:
        print(f"Error: {e}")

# Example usage
agent_number = 'your_agent_number'  # Replace with the actual agent number
token = 'your_bearer_token_here'  # Replace with your actual bearer token
agent_data = get_agent_data(agent_number, token)
print(agent_data)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class AgentDataFetcher {

    public static void main(String[] args) {
        String agentNumber = "your_agent_number"; // Replace with the actual agent number
        String token = "your_bearer_token_here"; // Replace with your actual bearer token
        String response = getAgentData(agentNumber, token);
        System.out.println(response);
    }

    private static String getAgentData(String agentNumber, String token) {
        try {
            // URL with the agent number included in the query parameters
            URL url = new URL("https://uat-businessapi.spenn.com/api/Partner/GetAgent?agentNumber=" + agentNumber);

            // Open a connection
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method and headers
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + token);

            // Reading the response
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            connection.disconnect();

            // Return the response content
            return content.toString();

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

async function getAgentData(agentNumber, token) {
    // URL with the agent number included in the query parameters
    const url = `https://uat-businessapi.spenn.com/api/Partner/GetAgent?agentNumber=${agentNumber}`;

    // Setting up the request headers
    const headers = {
        'Authorization': `Bearer ${token}`
    };

    try {
        // Sending the GET request
        const response = await fetch(url, { method: 'GET', headers: headers });

        // Parsing the JSON response
        const data = await response.json();
        return data;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Example usage
const agentNumber = 'your_agent_number'; // Replace with the actual agent number
const token = 'your_bearer_token_here'; // Replace with your actual bearer token

getAgentData(agentNumber, token)
    .then(data => console.log(data))
    .catch(error => console.error('Error in fetching agent data:', error));

👍

Sample Response

{
  "agentNumber": 5697,
  "customerGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", 
  "agentName": "string",
  "phone": "string",
  "imageUrl": "string",
  "currencyId": 0
}