I am using third party api in their sdk they have given option to fetch data on the base of where condition like this
Ordering.users.all({
mode: 'dashboard',
params: 'id,name,lastname',
where: [
{
attribute: 'level',
value: {
condition: '=',
value: 4,
}
}
]
},function (res) {
if (!res.error) {
$scope.drivers_filter = res.result
} else MyAlert.show(res.result)
})
in the console it seems like this
Request URL: https://apiv4.ordering.co/v400/es-419-1/devyv4/users?mode=dashboard¶ms=id,name,lastname&where=[{%22attribute%22:%22level%22,%22value%22:{%22condition%22:%22=%22,%22value%22:4}}]
but when i use this url in fetch()
it doesn't work
fetch("https://apiv4.ordering.co/v400/en/devyv4/users&where[{%22attribute%22:%22level%22,%22value%22:{%22condition%22:%22=%22,%22value%22:4}}]", {
method: "GET",
headers: {
"x-api-key": ""
}
}).then(r => r.json().then(data => (alert(JSON.stringify(data.result)))))
How i can use this in url ?
Look closely at the URL you're passing. You need to define the start of your search string with ?
fetch("https://....co/v400/path?mode=dashboard¶ms=id,name,lastname&where...")