function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sancasanca 

SOAP API or Rest Api

Hi All ,

There is an integration code which is already developed in our org , I am not sure whether they have used SOAP API or REST API in achieving the integartion .
Below is the code , can you please help me .

private string Senddata(string authdetails,string endPoint,string soapAction,string requestBody)
    {

        Httprequest soap_request = new Httprequest();

        string xml='';
        http soa = new http();
        Httpresponse soap_response = new Httpresponse();
        soap_request.setEndpoint(endPoint);
        soap_request.setHeader('SOAPAction',soapAction);
        
        soap_request.setMethod('POST');
        soap_request.setHeader('X-DocuSign-Authentication', authdetails);
        soap_request.setHeader('Content-type', 'text/xml; charset=utf-8');
        soap_request.setHeader('Content-Length', ''+requestBody.length());
        
        soap_request.setTimeout(30000);
        soap_request.setBody(requestBody);
        try
        {
            soap_response = soa.send(soap_request);
            xml = soap_response.getbody();
            
        }
        catch(System.CalloutException ex)
        {
            System.Debug('Call out Exception thrown: ' + ex.getMessage());
            throw ex;
        }
        catch (Exception e)
        {
            xml=e.getmessage();
            System.Debug('Exception occured: ' + e.getMessage());
        }
        return xml;
    }

The data is sent in form of xml .

Few are saying its Rest and few are saying its SOAP
Marek Kosar_Marek Kosar_
HTTP request == REST API