简体   繁体   English

Postman Twinfield API 请求删除交易

[英]Postman Twinfield API request deleted transactions

I'm trying to request the deleted transactions from the twinfield api.我正在尝试从 twinfield api 请求已删除的交易。 As far as I can get from the documentation I'm making a valid request with Postman but everytime I get a return code 500 -> internal server error.据我从文档中获得的信息,我正在向 Postman 发出有效请求,但每次我收到返回代码 500 -> 内部服务器错误。 I'm using the following soap request:我正在使用以下肥皂请求:

<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>

the headersettings look the following: headersettings headersettings 如下所示: headersettings

I've tried it ony the company code as the rest is optional but this gave me the same result.我已经尝试过公司代码,因为其余的都是可选的,但这给了我相同的结果。

Any advise on how to get the return with the deleted transactions?关于如何通过已删除的交易获得退货的任何建议?

your datefrom and dateto values are invalid.您的 datefrom 和 dateto 值无效。 Those should not include the date seperators (-).这些不应包括日期分隔符 (-)。 this should work:这应该工作:

<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>

In the end it was de XML schema that was missing, the correct XML envelope needs to look like this最后缺少的是 de 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM