'Simple Twinfield API request with Postman

I want to connect sales invoices with javascript/ google apps script. Therefore I want to test some things with Postman. I know, that the API works with XML and to get data you need to use the so called Browse code 100. But I am stucked with creating a working request to get sales invoice data :(

What I did so far:

  • Read the Twinfield API documentation
  • Created a login in the developer portal
  • Managed to request authorization code with Postman: I did a workaround to adjust the parameters in Postman and then paste the request URL into the browser
  • Managed to request access token
  • Determine cluster

I did a lot of research but couldn't find any examples I could understand. Examples like

  • how should a request URL in Postman look like
  • what parameters do I need
  • is it possible to have a handy request in javascript to get open sales invoices

I would be very grateful for any help!



Solution 1:[1]

Try this

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Header>
        <Header xmlns="http://www.twinfield.com/">
            <AccessToken>{{Accescode}}</AccessToken>
            <CompanyCode>{{Company}}</CompanyCode>
        </Header>
    </soap:Header>
    <soap:Body>
        <ProcessXmlDocument xmlns="http://www.twinfield.com/">
            <xmlRequest>
                <columns code="100">
                    <column xmlns="">
                        <field>fin.trs.head.yearperiod</field>
                        <operator>between</operator>
                        <from>2021/01</from>
                        <to>2022/01</to>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.code</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.shortname</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.number</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.status</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.date</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.dim2</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.dim2name</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.head.curcode</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.valuesigned</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.basevaluesigned</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.repvaluesigned</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.openbasevaluesigned</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.invnumber</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.datedue</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.matchstatus</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.matchnumber</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.matchdate</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.openvaluesigned</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.availableforpayruns</field>
                        <visible>true</visible>
                    </column>
                    <column xmlns="">
                        <field>fin.trs.line.modified</field>
                        <visible>true</visible>
                    </column>
                </columns>
            </xmlRequest>
        </ProcessXmlDocument>
    </soap:Body>
</soap:Envelope>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tjaym