Proper multi-id syntax when using the custom_file_ids[] query parameter for the CLIO API "contacts" endpoint - clio-api

What is the correct API syntax for using the custom_file_ids[] query parameter to specify multiple fields (but not all) in the CLIO API contacts result set? I need to specify multiple custom fields. I can get it to work for a single field, but not multiple fields at the same time.
Specifically, how do I specify and delimit the multiple fields? I have tried the following:
custom_file_ids[]=1234567,2345678
custom_file_ids[]=[1234567,2345678]
custom_file_ids[]=(1234567,2345678)
custom_file_ids[]={1234567,2345678}
custom_file_ids[]=1234567:2345678
The API documentation at https://app.clio.com/api/v4/documentation is silent on the list syntax that it expects.
Below is one specific API call I tried (both the actual URL-encoded call, and a decoded one for clarity) using a simple comma-delimited list, but which only returns custom field data for the first ID in the list--not the second. If I enclose the ID list in any kind of brackets (per above), the endpoint returns a 404 error.
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567%2C2345678&custom_field_values[4529224]=true&fields=id%2Cname%2Cprimary_address%2Cprimary_work_address%2Cis_client%2Ctype%2C%20primary_email_address%2Cprimary_phone_number%2Ccustom_field_values%7Bid%2Cfield_type%2Cfield_name%2Cvalue%2Ccustom_field%7D
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567,2345678&custom_field_values[4529224]=true&fields=id,name,primary_address,primary_work_address,is_client,type,primary_email_address,primary_phone_number,custom_field_values{id,field_type,field_name,value,custom_field}

Try:
custom_file_ids[]=1234567&custom_file_ids[]=2345678
I was able to do this with Contacts Custom Fields by putting custom_field_id[] on the URL as many times as you have IDs.
I hope this helps.

Related

Salesforce API - Using Compound fields. (Cannot deserialize instance of MailingAddress from VALUE_STRING)

Using REST API for Salesforce, I am trying to insert/update a contact into my business org where 'MailingAddress' is one of the fields with some set data, though in response I am getting this error message 'Cannot deserialize instance of MailingAddress from VALUE_STRING', the same response also resulting in 'OtherAddress'.
To my understanding, I think this is due to the reason that 'MailingAddress' and 'OtherAddress' are not actual fields that contains some String data, rather they take a dynamic address which resulting in filling up all other related fields like - 'MailingCity, MailingStreet, etc'.
So I have 2 questions:
1. How can I set 'MailingAddress' and 'OtherAddress' fields using API parameter only?
2. Is there any manual/documentation for this reference? As I am also having trouble with 'OtherLatitude' and 'OtherLogitude' fields.
Address and geolocation fields are compound fields.
You need to provide the value for the different components of the field, so for example, for MailingAddress you would need to provide MailingStreet, MailingCity, MailingState or MailingStateCode, etc. And for OtherAddress you would provide OtherStreet, OtherCity, etc.
For more information on compound fields: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/compound_fields.htm

Like parameter in REST api url endpoint

Is it possible to pass parameters with 'like' keyword in REST api endpoints. Basically I'm trying to create an endpoint wherein I would query a db to get list of items based on '%name%'.
The corresponding query in DB would be like:
SELECT * FROM users WHERE user_id like "%arjun%"
So I would need to add parameters to my REST endpoint wherein i can fetch teh data based on name=%arjun%
Is that really possible?
Thanks
Arjun
I would recommend to user name=value and then create your sql with %%. You can put % into your GET call but it can cause bugs because % is special character which is used to encode other special characters.
But if you really want to go with name=%value% then you can put %25 instead of %. So something like this name=%25value%25

How to use scopeDescriptor and subjectTypes in VSTS Graph api groups list query?

I am trying to resolve a particular VSTS group by name to retrieve the identityDescriptor property. Rather than query all groups and filter, I want to leverage the query parameters supported. Looking at VSTS Groups - List API, it supports the additional query parameters scopeDescriptor, and subjectType. However, I keep providing bad values for these parameters.
However, when I specify any combination of these I get 0 results. In addition, as soon as I add a scopeDescriptor, I hit an Microsoft.VisualStudio.Services.Graph.InvalidSubjectTypeException -> HTTP 400 Bad Request.
Questions:
What are examples of expected values for subjectTypes?
Edit 1
subjectTypes are not the actual type, but the subtype that prefixes the subject descriptor. For example -> vssgp,aadgp:
"subjectDescriptor": "vssgp.Dc0NDgzLTzQ1NwOTI5LTI0NTcwNDLTAtMwUy0xLTktMTAtMC0wMjgxNjcxNDU0OS0zMU1MTM3NDI0NS0yMjUzNzA0ODMtE"
What are examples of expected values for scopeDescriptor?
Example query urls:
- Working:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?api-version=4.1-preview.1
- Working subjectTypes:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?subjectTypes=vssgp&api-version=4.1-preview.1
- scopeDescriptor throws:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&api-version=4.1-preview.1
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&subjectTypes=Microsoft.TeamFoundation.Identity&api-version=4.1-preview.1
You can get the scope descriptors for a project or a collection by making an api request to https://vssps.dev.azure.com/{organization}/_apis/graph/descriptors/{Id}(replace id with projectId if you want to get the scope descriptor for a project and so on).
For example if you want to get the scope descriptor for a project then simply replace the storage key in the request URL with the project Id and in response you get the scope descriptor. The scope descriptor has the following format scp.(long unique identifier).
P.S: More on how to get descriptors can be found here https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/descriptors/get?view=azure-devops-rest-5.0. Remember storagekey can be substituted with projectid or collectionid to get specific descriptors.
Regarding subjectTypes, it is the group type, such as vssgp, aadgp, you can get it from descriptor value of each group.

Rest API: How should the filter params send to API in case query based on nested resource

I have two entities Properties and Bookings.
I need to know the URL structure in case I'm filtering the properties base on query on bookings.
In my case I need to get the properties which are free (not occupied) at specific date.
Can it be
api/properties/free/{date}
Or
api/properties/bookings?bookingDate!='1-1-2017'
Or
api/properties?bookingDate!='1-1-2017'
it seems for me that the last one is the more appropriate but the filter is on the bookings not on the properties which is not obvious.
The Facebook Graph API has a interesting way of doing nested queries by using a strategy of fields filter.
The fields filter it´s a way of filter specific fields or nested fields of a rouserce. They also create a standard way to inform functions for every selected field like: limit or equal.
Your request would be something like this:
GET /api/properties?fields=bookings{bookingDate.notEqual('1-1-2017')}
For more information about Facebook´s GraphAPI:
https://developers.facebook.com/docs/graph-api/overview/

How to make a GET request using a filter on a datetime property with EspoCRM REST API?

EspoCRM provides a REST API that sadly has only incomplete documentation. Especially the filters that can be used with a GET request are not documented:
where - (array) filters;
From using Firebug I've discovered that a filter consists of three query parameters:
where[0][field]=somefield
where[0][type]=somoperator
where[0][value]=somevalue
Example, filter on name=Foo:
?where[0][field]=name&where[0][type]=equals&where[0][value]=Foo
The meaning of equals is not documented, as are the possible filter types.
Now I want to filter a collection on a datetime field modifiedAt. I have no idea what the proper values for type and value would be to find all entities that have been modified after a given datetime.
How can the EspoCRM REST API be used for this?
After playing around with the EspoCRM web GUI, I was able to make a search that uses the filter I need. The query parameters are:
where[0][type]=after
where[0][field]=modifiedAt
where[0][value]=2016-06-01 16:12:00
where[0][dateTime]=true
where[0][timeZone]=Europe%2FBerlin