如何使用查询字符串中的请求参数来检索JobNimbus联系人



我正试图根据联系人的显示名称在JobNimbus中获取联系人。根据他们在";检索所有联系人";,我应该能够做到这一点。

以下是他们推荐的代码:

var axios = require('axios');
var config = {
method: 'get',
url: 'https://app.jobnimbus.com/api1/contacts',
headers: { 
'Authorization': 'bearer <token>', 
'Content-Type': 'application/json'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

以下是他们的请求参数示例:

{
"must": [
{
"range": {
"date_created": {
"gte": 1459749600,
"lte": 1459835940
}
}
}
]
}

如何根据他们的display_name请求联系人?

它解释了如何在这里的文档中过滤搜索。只需在查询参数中包含搜索条件即可。

var axios = require('axios');
var config = {
method: 'get',
url: 'https://app.jobnimbus.com/api1/contacts?filter={"must":[{"term":{"first_name":"John"}},{"term":{"last_name":"Smith"}}]}
',
headers: { 
'Authorization': 'bearer <token>', 
'Content-Type': 'application/json'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

最新更新