【问题标题】:DHL Api integration with C#DHL Api 与 C# 的集成
【发布时间】:2020-01-25 06:30:17
【问题描述】:

我正在尝试为跟踪包裹实施 DHL API。 一切正常,我从 DHL 服务器接收数据,但是,我不明白应该如何在请求中使用 MessageTime 和 MessageReference 值,我应该在每个参数中输入什么或如何做到这一点。 谢谢

<ServiceHeader>
<MessageTime>2019-09-23T15:54:10</MessageTime>                  
<MessageReference>xxxx</MessageReference>
</ServiceHeader>

【问题讨论】:

    标签: c# api dhl


    【解决方案1】:

    它会在 API 文档中得到很好的注释。

    我个人在发货 API 中使用以下内容,cmets 会从提供的文档中收集到。

    这是来自我的个人代码,不是跟踪 API,但我想它会相似且一致:

    // Mandatory - The MessageTime element contains the time at which the message was sent by the requestor. The format of
    // the element should be YYYY-MM-DD(T)hh-mm-ss - Time Zone where “T” is the separator between date
    // and time
    request.ServiceHeader.MessageTime = DateTime.Now;
    
    // Mandatory - The MessageReference element should contain a unique reference to the message, so that trace of
    // a particular message can easily be carried out. It must be a minimum length of 28 and maximum
    // 32.The value can be decided by the customer.
    request.ServiceHeader.MessageReference = Guid.NewGuid().ToString("N");
    

    编辑

    我仔细检查了跟踪 API,结果是一样的:

    【讨论】:

      猜你喜欢
      • 2014-09-12
      • 1970-01-01
      • 2021-06-12
      • 2022-07-18
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 2016-10-11
      • 2014-03-02
      相关资源
      最近更新 更多