你的位置:首页 > ASP.net教程

[ASP.net教程]eBay 消息发送(1)


 

1.简介

Call Index Doc:

http://developer.ebay.com/DevZone/

 

消息发送主要分为三类:

AddMemberMessageRTQ

允许卖家回复关于在线item的问题。

AddMemberMessageAAQToPartner

见 eBay消息发送(2)

AddMemberMessagesAAQToBidder

见 eBay消息发送(3)


 

2.AddMemberMessageRTQ

以MemberMessageType作为载体发送。

2.1输入字段

 

ItemID

提问所应对的Item唯一ID。

 

MemberMessage内容

Body

消息的主体,不支持原生的HTML,编码后的HTML也不会自动解码。最大长度为2000。

DisplayToPublic

表明这条消息是否在item listing中可见。

ParentMessageID

需要回复的消息ID。

RecipientID

收件人,填入eBay用户ID。

SendID

发件人ID


 

2.2输出

 

 

ApiResponse内容

Ack

CustomCode

(out) Reserved for internal or future use.

Failure

(out) Request processing failed

Success

(out) Request processing succeeded

Warning

(out) Request processing completed with warning information being included in the response message

Errors


 

2.3沙箱测试

You can test this call in the Sandbox. To test AddMemberMessageRTQ, you must have at least two test users in the Sandbox environment.

  1. List an item in the Sandbox using AddItem.
  2. Have a different user send the seller a question about the item. You can use the Sandbox UI for this step.
  3. Using the seller as the authenticated user, call GetMemberMessages (this will be the user for AddMemberMessageRTQ).
  4. In the call to AddMemberMessageRTQ, set ParentMessageID to the value ofMemberMessage.MemberMessageExchange.Question.MessageID that was returned from the GetMemberMessages call.
  5. Set RecipientID to the user ID of the original sender.
  6. Type the response to the question in the Body field.

 

3.样例代码

 

  1. public void SendMessagesRTQ(ApiContext context, string subject, string body, string recipientID, string parentMessageID, string senderID, string itemID)
  2. {
  3.     try
  4.     {
  5.         //回复客人消息
  6.         var addCall = new AddMemberMessageRTQCall(context);
  7.         var memberMessageType = new MemberMessageType()
  8.         {
  9.             Body = body,
  10.             ParentMessageID = parentMessageID,
  11.             RecipientID = new StringCollection { recipientID },
  12.             SenderID = senderID,
  13.             DisplayToPublic = false,
  14.             DisplayToPublicSpecified = true
  15.         };
  16.  
  17.         //用于回复买家Message的Call,不过只能用于回复买家关于在线商品的提问
  18.         addCall.AddMemberMessageRTQ(itemID, memberMessageType);
  19.     }
  20.     catch (Exception ex)
  21.     {
  22.         throw new EbayAPIExpcetion(ex.Message, ex.InnerException == null ? ex : ex.InnerException);
  23.     }
  24. }