eBay Notification介绍
1.简介
"通知服务"(约定为Notification的中文名称),是EbayAPI提供的一个便捷的工具,具有实时性的特点。
其设计思想基于发布-订阅模式。一旦客户端订阅了需要通知的事件,服务器发送通知时,客户端就实时接收从eBay发送的通知。
官网API文档:
http://developer.ebay.com/Devzone/guides/ebayfeatures/Notifications/Notifications.html 此文档应该是最好的第一手资料.
论坛帖子:
http://community.ebay.cn/thread-1200288175-1-1.html 此帖子比较全面.
.NET WebService接收例子:
https://ebaydts.com/eBayKBDetails?KBid=2112 直接可以拿过来用,主要是对SOAP消息接收的配置。
2.Usage
2.1流程描述
1)使用SetNotificationPreference接口去设定订阅的event type、通知地址(email或url)
2)如果选择Email,只需考虑收到邮件之后你将如何处理;
3)如果选择URL,则需要提供一个地址,如ebayapi.company.com的地址来接收,此处注意,端口号尽量使用80(8080和443没有试过,应该可以过),但是用了94,结果死活都收不到。问了ebay的技术,只能用默认端口。
4)当有订阅的event发生时,ebay会主动推送消息去你事先设定好的通知地址上。
2.2 设置接收地址
主要分为提醒邮箱设置、默认接收URL、指定URL(最多25个)三块。
依次分别是AlertEmail,ApplicationURL,DeliveryURLDetailType
- [Test]
- public
void SetNotification_EnableOrDisable_ApplicaitonDelivery_Test() - {
- var context = ApiContextFactory.GetApiContext(token);
- //var context = SandBoxEnvironment.GetApiContextOfSendBox();
- SetNotificationPreferencesCall call = new SetNotificationPreferencesCall(context);
- var enable = EnableCodeType.Enable;
- var type = new ApplicationDeliveryPreferencesType()
- {
- AlertEmail = "mailto://1050244110@qq.com",
- AlertEnable = enable,
- AlertEnableSpecified = true,
- ApplicationURL = "mailto://1050244110@qq.com",
- ApplicationEnable = enable,
- ApplicationEnableSpecified = true,
- DeliveryURLDetails = new DeliveryURLDetailTypeCollection(
- new DeliveryURLDetailType[] {
- new DeliveryURLDetailType()
- {
- Status = enable,
- DeliveryURLName = "seller1_Delivery",
- DeliveryURL = "http://address1.com",
- StatusSpecified = true
- },new DeliveryURLDetailType(){
- Status = enable,
- DeliveryURLName = "seller2_Delivery",
- DeliveryURL = "http://address2.com",
- StatusSpecified = true
- }})
- };
- call.SetNotificationPreferences(type);
- }
查看指定结果
- [Test]
- public
void GetNotification_RoleCodeType_Application_Test() - {
- var context = ApiContextFactory.GetApiContext(token);
- //var context = SandBoxEnvironment.GetApiContextOfSendBox();
- GetNotificationPreferencesCall call = new GetNotificationPreferencesCall(context);
- call.GetNotificationPreferences(NotificationRoleCodeType.Application);
- Console.WriteLine(call.ApplicationDeliveryPreferences);
- Console.WriteLine(call.ApplicationDeliveryPreferences.AlertEmail);
- Console.WriteLine(call.ApplicationDeliveryPreferences.ApplicationURL);
- Console.WriteLine(call.ApplicationDeliveryPreferences.AlertEnable.ToString());
- Console.WriteLine(call.ApplicationDeliveryPreferences.ApplicationEnable.ToString());
- Console.WriteLine(call.ApplicationDeliveryPreferences.DeviceType.ToString());
- Console.WriteLine(call.ApplicationDeliveryPreferences.NotificationPayloadType.ToString());
- foreach (DeliveryURLDetailType item in call.ApplicationDeliveryPreferences.DeliveryURLDetails)
- {
- Console.WriteLine(item.DeliveryURL);
- Console.WriteLine(item.DeliveryURLName);
- Console.WriteLine(item.Status.ToString());
- }
- }
2.3订阅EventType
- [Test]
- public
void SetNotificationPreferences_EnableOrDisbable_EventTypes() - {
- var context = ApiContextFactory.GetApiContext(token);
- //var context = SandBoxEnvironment.GetApiContextOfSendBox();
- SetNotificationPreferencesCall call = new SetNotificationPreferencesCall(context);
- var enable = EnableCodeType.Enable;
- call.DeliveryURLName = "seller1_ Delivery "; //如果指定了,则使用对应名称的URL,反之,则使用 ApplicationURL
- var coll = new NotificationEnableTypeCollection();
- coll.Add(new NotificationEnableType()
- {
- EventEnable = enable,
- EventEnableSpecified = true,
- EventType = NotificationEventTypeCodeType.AuctionCheckoutComplete,
- EventTypeSpecified = true
- });
- coll.Add(new NotificationEnableType()
- {
- EventEnable = enable,
- EventEnableSpecified = true,
- EventType = NotificationEventTypeCodeType.FixedPriceTransaction,
- EventTypeSpecified = true
- });
- coll.Add(new NotificationEnableType()
- {
- EventEnable = enable,
- EventEnableSpecified = true,
- EventType = NotificationEventTypeCodeType.EndOfAuction,
- EventTypeSpecified = true
- });
- call.SetNotificationPreferences(coll);
- }
查看订阅结果
- [Test]
- public
void GetNotification_UserLevel_Test() - {
- var context = ApiContextFactory.GetApiContext(token);
- //var context = SandBoxEnvironment.GetApiContextOfSendBox();
- GetNotificationPreferencesCall call = new GetNotificationPreferencesCall(context);
- call.GetNotificationPreferences(NotificationRoleCodeType.User);
- Console.WriteLine(call.DeliveryURLName);
- Console.WriteLine(call.DetailLevelList.Count);
- foreach (NotificationEnableType item in call.UserDeliveryPreferenceList)
- {
- Console.WriteLine(item.EventEnable.ToString());
- Console.WriteLine(item.EventType.ToString());
- }
- }
2.4 邮件接收结果截图
内容就是XML文档。
3.注意事项
3.1 端口
如果使用http或https的方式,端口号尽量使用默认端口号(80,443)
3.2 token
订阅某个卖家的EventType时,需要指定此卖家的token;
3.3 ApplicationDeliveryPreferencesType
当ApplicationDeliveryPreferencesType设置为Disable时,所有启用的订阅事件将不发送,除非将其又设置为Enable。
eBay Notification介绍的更多相关文章
- Android之Notification介绍
Notification就是在桌面的状态通知栏.这主要涉及三个主要类: Notification:设置通知的各个属性. NotificationManager:负责发送通知和取消通知 Notifica ...
- android Notification介绍
如果要添加一个Notification,可以按照以下几个步骤 1:获取NotificationManager: NotificationManager m_NotificationManager=(N ...
- Rxjs中Notification 介绍
timer(0, 1000) // 计时器,每1000ms发射一个值,初始发射值延迟时间为0s: .pipe( take(5), // 取前5个值 takeWhile(value => valu ...
- Android Notification 版本适配方案
Notification 介绍见:https://developer.android.com/reference/android/app/Notification.html Android api 一 ...
- Android学习笔记总结
第一步: Android(1) - 在 Windows 下搭建 Android 开发环境,以及 Hello World 程序 搭建 Android 的开发环境,以及写一个简单的示例程序 · 在 Win ...
- Jenkis Editable Email Notification Plugin 使用介绍
Jenkis Editable Email Notification Plugin 使用介绍 前言 Jenkins本身提供的Email插件功能实在有限,只能提供当前Job的基本信息,比如成功.失败以及 ...
- Apache DolphinScheduler 架构演进介绍及开源经验分享 - eBay 阮文俊
引言 来自 eBay 的文俊同学在近期的上海开源大数据 Meetup 上做了十分精彩的 "Apache DolphinScheduler 的架构演进" 分享.本次分享有近 200 ...
- 使用eBay API基本步骤介绍
要开始使用eBay API,需要如下基本步骤: 1. 注册开发帐号: https://developer.ebay.com/join/Default.aspx 2. 选择API类型: eB ...
- 介绍一个比较酷东西:HTML5 桌面通知(Notification API)
Notification API 是 HTML5 新增的桌面通知 API,用于向用户显示通知信息.该通知是脱离浏览器的,即使用户没有停留在当前标签页,甚至最小化了浏览器,该通知信息也一样会置顶显示出来 ...
随机推荐
- smb
smb编辑 SMB(Server Message Block)是协议名,它能被用于Wap连接和客户端与服务器之间的信息沟通.
- CocoStudio基础教程(5)使用CocoStudio场景编辑器关联组件
1.概述 我们有了UI交互.有了动画人物.有了物理模拟,还差最后一步——将这些元素融合起来.这就要用到cocoStudio中的场景编辑器了.这次我们要将先前我们做过的所有东西都放到一个场景中去.这项工 ...
- xxxx is not translated in zh-rCN, zh-rTW
1.异常提示: "image_content" is not translated in zh-rCN, zh-rTW 2.错误原因: 根据报错提示,是说我没有对string文件做 ...
- Linux下安装配置MongoDB 3.0.x 版本数据库
说明: 操作系统:CentOS 5.X 64位 IP地址:192.168.21.128 实现目的: 安装配置MongoDB数据库 具体操作: 一.关闭SElinux.配置防火墙 1.vi /etc/s ...
- HDFS深入浅析
导读 Hadoop分布式文件系统(HDFS)被设计成适合运行在通用硬件(commodity hardware)上的分布式文件系统.它和现有的分布式文件系统有很多共同点.但同时,它和其他的分布式文件系统 ...
- 他们在军训,我在搞 OI(二)
Day 2 7:26 2016/8/25 新的一天又开始了! 走在上学的路上,抬头看看北京少有的蓝天,太阳的威力不再那么明显,甚至输给了挡住它的云朵.迎面吹来了凉爽的风,夏天的燥热,早已无影无踪. 许 ...
- django-cms 代码研究(六)plugin的深入分析
示例代码: https://github.com/divio/djangocms-picture 以上一个图片的插件,安装后可在页面中添加图片,效果如下图: 以此为切入点,分析plugin的逻辑: 分 ...
- thinkphp 前台html调用函数 格式化输出
仅仅是输出变量并不能满足模板输出的需要,内置模板引擎支持对模板变量使用调节器和格式化功能,其实也就是提供函数支持,并支持多个函数同时使用.用于模板标签的函数可以是PHP内置函数或者是用户自定义函数,和 ...
- Android的Observable和iOS的NotificationCenter
使用起来很类似,参看以下网址http://stackoverflow.com/questions/10327200/equivalent-of-ios-nsnotificationcenter-in- ...
- Delphi经验总结(2)
Q: 怎么来改变ListBox的字体呢?就修改其中的一行. A: 先把ListBox1.Style 设成lbOwnerDrawFixed 然后在 OnDrawItem 事件下写下如下代码 proced ...