Search code examples
apirequestresponsesandbox

What means a static response from an API and Sandbox?


I am working for the first time with API-s. My first task at my job is to call an API, I am working with the Sandbox version of the API

I am trying to call the Sandbox this way and I should get a static response, but I am getting

"Error at message validation"

what means this and what exactly is a Sandbox and what is a static response?

procedure consentrequest(out transactionid1:transactionIdType);
        var
        Httprio2 : THTTPRio;
        initiateConsentRequest1 : initiateConsentRequest;
        initiateconsentrequestresponse1 : initiateconsentrequestresponse;
        type2 :consenttype;
        consent_init : consent2;
        //AccountInfo_PT2 : AccountInfo_PT;
        //transactionId1 : transactionIdType;
    begin
       initiateConsentRequest1 :=initiateConsentRequest.Create;
       initiateconsentrequestresponse1 :=initiateconsentrequestresponse.Create;
       consent_init :=consent2.Create;
       HTTPRio2 :=THTTPRIO.Create(nil);
       HTTPRio2.Url := 'https://sandbox.budapestbank.hu/OpenapiSandbox/v1.0.0';

       consent_init.type_ :=type2;
       consent_init.target := 'HU12345678901234567890123456';
       consent_init.validityPeriod :=30;
       initiateConsentRequest1.consent :=consent_init;
       ShowMessage('Before PT');
    initiateconsentrequestresponse1 :=(HTTPRio2 as AccountInfo_PT).initiateConsentRequest(initiateConsentRequest1);
       ShowMessage('After PT');
       transactionid1 := initiateconsentrequestresponse1.transactionId;

    end;

Solution

  • A Sandbox is usually a non-production copy of the API, you might use different creds and get sample data responses. It's a safe practice space for developers.

    The error about "message validation" makes me think that the API request you sent was somehow invalid, perhaps it is missing a parameter. Check the docs of the API you are calling and make sure you have the correct verb/endpoint and parameters. Also see if there is more information in the response itself.