跟踪代码的数据类型和操作 [英] Tracking codes data type and manipulation

查看:74
本文介绍了跟踪代码的数据类型和操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟踪代码允许企业(例如我们)在Box上的用户数据中存储一些本地ID。我意识到需要在企业(我们的联系人正在努力)上启用该功能。

Tracking codes allow an enterprise (such as us) to store some local ID in the users' data on Box. I realize that the functionality needs to be enabled on the enterprise (which our contacts are working on).

第一个问题:文档说它是一个数组,其他答案表明它是名称/值对的数组。在数据类型中,Box API到底是什么才算是名称/值对?

First question: The documentation says it's an "array", and other answers indicate that it's an array of "name/value pairs". In datatypes, what exactly does Box API consider to be a "name/value"-pair?

它是包含字符串键和字符串值的字典列表吗?这种情况-如果两个字典共享键,会出现一个带有 /分隔符的字符串列表,还是可以将我喜欢的任何数据类型放入数组中呢?

Is it a list of dictionaries with string keys and string values (and in that case - what happens if two of the dictionaries share keys), a list of strings with a "/" separator, or can I put any data type I like into the array?

第二个问题:我是否像普通属性一样操作tracking_codes数组(即我将新数组放入/2.0/users/USERID进行更新),还是像其他数组一样进行管理(例如电子邮件别名)?通过POST / DELETE到/2.0/users/USERID/tracking_codes?

Second question: do I manipulate the tracking_codes array like a normal attribute (i.e. do i PUT a new array to /2.0/users/USERID to update it), or do I manage it like other arrays (such as email aliases) by POST/DELETE to /2.0/users/USERID/tracking_codes?

谢谢。

推荐答案

好...这里没有答案,Box的支持也没有答案,所以我尝试并联系了另一家可以将其工作脚本用作基础的企业。

Ok... No answers here, and none from Box support, so I experimented and contacted another enterprise whose working script I could use as a base.


  1. 需要为企业启用 tracking_codes。该文档没有提及这一点。如果您未启用tracking_codes,则会收到标准且非常无助的无效请求参数错误。

  1. "tracking_codes" need to be enabled for the enteprise. The documentation does not mention this. If you don't enable tracking_codes, you get the standard and very unhelpful "invalid request parameters" error.

您打算使用的特定tracking_code的名称必须在Box的管理页面的企业设置(用户设置选项卡)中注册。该文档错误地指出可以使用任何名称/值对,但只能使用预先注册的名称。如果您使用的名称尚未注册,则会收到无用的无效请求参数错误。

The names of the specific tracking_codes you intend to use must be registered in the "enterprise settings" ("user settings" tab) of Box' administration pages. The documentation wrongly says that "any name/value pair" can be used, but only names that are pre-registered work. If you use a name that hasn't been registered, you get the unhelpful "invalid request parameters" error.

要设置跟踪代码,请更新列表的跟踪代码作为属性。每个名称/值对的格式必须为: { type: tracking_code, name: [您已注册的名称], value: [任何字符串] } 。因此,例如,如果您已将 personid注册为有效的tracking_code,则可以将正文

To set a tracking_code, you update the list of tracking_codes as an attribute. The format of each name/value pair must be: {"type": "tracking_code", "name": "[a name you have registered]", "value": "[any string]"}. So for example, if you've registered "personid" as a valid tracking_code, you can PUT to /2.0/users/[userid] the body

{"tracking_codes": [{"type": "tracking_code", "name": "personid", "value": "1318231313"}]}

我找不到任何设置删除跟踪代码的方法。 PUT:空列表无济于事。最好的可能性似乎是将一个空字符串作为跟踪代码的值,但是它当然仍会返回。

I have not found any way to remove a tracking_code once set. PUT:ing an empty list does nothing. The best possibility seems to be putting an empty string as value for the tracking code, but it is still returned of course.

这篇关于跟踪代码的数据类型和操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆