×

Using the REST API

Last updated: July 19, 2022

It is possible to use a REST API within MA!N. To do this, you make a command like the one in the example shown below.

Command:

<?xml version='1.0'?>
<HttpWebRequest>
      <Create>
            <Address><![CDATA[https://api.acceptemail.com/v2/Bill]]></Address>
      </Create>
      <Credentials>
            <userName>CEIT_RESTAPI</userName>
            <password>password</password>
      </Credentials>
      <Method>POST</Method>
      <ContentType>application/json</ContentType>
      <Write>
            <buffer>
                  <SQL>
                        <![CDATA[
                        SELECT '{
      "PaymentReference":"123456",
      "Description":"Description",
      "Amount":1,
      "ExpiryDate":"2020-05-27T11:58:06.9224376Z",
      "Address": {
    "Email": info@yourmail.com
}
}'
                ]]>
                  </SQL>
            </buffer>
      </Write>
      <Response>
            <SQL>
                  <![CDATA[
UPDATE [commands] set [memo] = ? where [command id] = X
    ]]>
            </SQL>
      </Response>

Next, you make a job in which you use ‘Web_Request; {command number} ;9999’ to invoke the command. The response will be in the question mark (?) , just like SOAP XML.