To retrieve history of requests created with a specific status you can 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.

Request Body

The request body is in JSON format and contains the following fields:

  • fromDate: The start date for the range of transaction requests.
  • toDate: The end date for the range of transaction requests.
  • requestStatus: The status of the transaction requests.
  • page: The page number for paginating the results. In this case.
  • pageSize: The number of items per page for paginating the results.

Sample Request:

import requests

url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/requests"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbG...NrEQ41w"
}

payload = {
    "fromDate": "2020-10-12",
    "toDate": "2020-10-13",
    "requestStatus": 4,
    "page": 1,
    "pageSize": 10
}

# Make the POST request
response = requests.post(url, json=payload, headers=headers)

# Check the response status
if response.status_code == 200:
    # Successful response
    print("Request was successful. Response JSON:")
    print(response.json())
else:
    # Handle the error
    print(f"Error: {response.status_code}\n{response.text}")

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

public class PostRequestExample {

    public static void main(String[] args) {
        try {
            String url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/requests";
            String authorizationHeader = "Bearer eyJhbG...NrEQ41w";

            // JSON payload
            String payload = "{" +
                    "\"fromDate\": \"2020-10-12\"," +
                    "\"toDate\": \"2020-10-13\"," +
                    "\"requestStatus\": 4," +
                    "\"page\": 1," +
                    "\"pageSize\": 10" +
                    "}";

            URL apiUrl = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();

            // Set the request method to POST
            connection.setRequestMethod("POST");

            // Set request headers
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", authorizationHeader);

            // Enable input/output streams
            connection.setDoOutput(true);

            // Write the payload to the request body
            try (OutputStream os = connection.getOutputStream()) {
                byte

const url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/requests";
const authorizationHeader = "Bearer eyJhbG...NrEQ41w";

// JSON payload
const payload = {
    fromDate: "2020-10-12",
    toDate: "2020-10-13",
    requestStatus: 4,
    page: 1,
    pageSize: 10
};

// Make the POST request
fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': authorizationHeader
    },
    body: JSON.stringify(payload)
})
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! Status: ${response.status}`);
        }
        return response.json();
    })
    .then(data => {
        // Process the successful response
        console.log("Request was successful. Response JSON:", data);
    })
    .catch(error => {
        // Handle errors
        console.error('Error:', error);
    });

👍

Sample Response:

{
"$id": "1",
"data": [ 
  {
	"$id": "2",
	"requestGuid": "1e6cc63a-2d0d-4885-9c51-f9a35f113811", 
	"requestStatus": "Cancelled",
	"timestampCreated": "2020-10-12T19:32:55.47", 
	"phoneNumber": "+250783008884",
	"message": "Please send some money",
	"amount": 10.00,
 	“externalReference”: “sasd23xfhaxfasdfa2342”, 
 	"transactionStatus": null
	} 
],
"total": 1 
}