ServiceM8 - 我可以过滤多个字段吗 [英] ServiceM8 - can I filter on more than one field

查看:37
本文介绍了ServiceM8 - 我可以过滤多个字段吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究与 ServiceM8 的集成,并希望使用 $filter REST API 进行多个过滤.类似于 company_uuid 和 status 的东西.ServiceM8 文档为他们提供了以下示例,但不包括对OR"/AND"类型逻辑的任何使用.

I am looking into an integration with ServiceM8 and would like to use the $filter REST API to filter by more than one. Something like company_uuid and status. The ServiceM8 documentation give they following example but does not include any use for 'OR'/'AND' type logic.

"https://api.servicem8.com/api_1.0/job.json?%24filter=company_uuid%20eq%20'10420f98-7626-4405-bf43-043f1036623b'

推荐答案

更新

您仍然可以按大多数字段进行过滤,但只能按一个.

You can still filter by most of the fields, but only one.

排除已完成的作业:

  • 用于排除已完成作业的过滤器(在整个 URL 中用于上下文)是:
  • The filter (in a whole URL for context) to exclude completed jobs is:

"https://api.servicem8.com/api_1.0/job.json?%24filter=status%20ne%20%22Completed%22"

  • 结构:


%24 : $
%20 : (space)
%22 : "
&   : &
"   : "

据我所知,它仍然不能与任何其他过滤器结合使用.添加过滤器会导致 500 错误,或者一个过滤器可以工作而另一个将被忽略,或者它甚至有时会给出返回响应,告诉您不要打扰:

It still cannot be used in conjunction with any other filter as far as I can see. Adding filters either causes a 500 error, or one filter will work and the other will be ignored, or it even sometimes gives a return response telling you not to bother:

{"errorCode":400,"message":"Advanced Record Filter Queries Not Supported"}

现实情况是,在撰写本文时,这是不可能的.过滤页面上的功能(当前最新修订版为 2014 年 7 月 1 日)是其功能的绝对范围.即便如此,它也不能完全起作用(例如,过滤 active 状态根本不起作用).

The reality is that at the time of writing this, that isn't possible. The functions on the Filtering page (Currently last revision July 1, 2014) are the absolute extent of it's functionality. Even then, it doesn't entirely work (For example, filtering for active status doesn't work at all).

检索整个端点同样快,但显然根据您的应用程序可能会产生不良处理或带宽影响

Retrieving the whole end point is just as quick, but obviously depending on your application may have undesirable processing or bandwidth implications

也许中间点是选择最具辨别力的过滤器来检索您的工作数据.

Perhaps the halfway point would be selecting the most discriminative filter to retrieve your working data.

  • 即您可以使用此过滤器获取自 2016 年 7 月 1 日以来的所有职位:

  • I.e. You can get all the jobs since 1st July 2016 using this filter:


%24filter=date%20gt%20%222016-07-01%22

那个具体的例子实际上包括了 7 月 1 日的工作(没有可用的 ge 过滤器),但这是猜测,因为你并不真正知道它是如何应用的gt 到您的数据,因为文档仅给出了匹配精确 uuid 和单个数字比较的示例.

That specific example actually includes jobs on the 1st July (There's no ge filter available), but it's guess work, as you don't really know how it's applying gt to your data as the documentation only gives an example of matching an exact uuid and a single numeric comparison.

这篇关于ServiceM8 - 我可以过滤多个字段吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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