Postman Twinfield API请求删除的事务处理

1hdlvixo  于 2022-11-07  发布在  Postman
关注(0)|答案(2)|浏览(207)

我尝试从twinfield api请求已删除的事务。就我从文档中所能得到的,我向Postman发出了一个有效的请求,但每次我都得到一个返回代码500 -〉内部服务器错误。我使用了下面的soap请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:twin="http://www.twinfield.com/">
    <soapenv:Header>
        <twin:Header>
            <twin:AccessToken>{{Accescode}}</twin:AccessToken>
            <twin:CompanyCode>{{Company}}</twin:CompanyCode>
        </twin:Header>
    </soapenv:Header>
    <s:Body>
        <Query i:type="a:GetDeletedTransactions" xmlns="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.DeletedTransactionsService">
            <b:CompanyCode>{{Company}}</b:CompanyCode>
            <b:Daybook>SomeDaybook</b:Daybook>
            <b:DateFrom>2021-04-01</b:DateFrom>
            <b:DateTo>2021-04-02</b:DateTo>
        </Query>
    </s:Body>
</s:Envelope>

标题设置如下所示:headersettings
我试过它ony公司代码,因为其余的是可选的,但这给了我相同的结果.
关于如何获得已删除交易的退货,有什么建议吗?

mm9b1k5b

mm9b1k5b1#

您的datefrom和dateto值无效。这些值不应包含日期分隔符(-)。应执行以下操作:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:twin="http://www.twinfield.com/">
    <soapenv:Header>
        <twin:Header>
            <twin:AccessToken>{{Accescode}}</twin:AccessToken>
            <twin:CompanyCode>{{Company}}</twin:CompanyCode>
        </twin:Header>
    </soapenv:Header>
    <s:Body>
        <Query i:type="a:GetDeletedTransactions" xmlns="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.DeletedTransactionsService">
            <b:CompanyCode>{{Company}}</b:CompanyCode>
            <b:Daybook>SomeDaybook</b:Daybook>
            <b:DateFrom>20210401000000</b:DateFrom>
            <b:DateTo>20210402235959</b:DateTo>
        </Query>
    </s:Body>
</s:Envelope>
ivqmmu1c

ivqmmu1c2#

最后,缺少的是XML模式,正确的XML信封应该如下所示

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:Authentication xmlns:h="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <AccessToken xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">{{Accescode}}</AccessToken>
            <CompanyCode xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">{{Company}}</CompanyCode>
        </h:Authentication>
    </s:Header>
    <s:Body>
        <Query i:type="b:GetDeletedTransactions" xmlns="http://www.twinfield.com/" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.DeletedTransactionsService">
            <b:CompanyCode>{{Company}}</b:CompanyCode>
            <b:DateFrom>2022-01-01T00:00:00</b:DateFrom>
            <b:DateTo>2022-12-31T23:59:00</b:DateTo>
            <b:Daybook></b:Daybook>
        </Query>
    </s:Body>
</s:Envelope>

相关问题