Send JSON query Array in GET request

Status
Not open for further replies.

Systemsaholic

Silver Partner
Basic Certified
Joined
Aug 8, 2022
Messages
3
Reaction score
0
Hi,

In order to pull contact records from my CRM by Phone Number, I need to pass a JSON query in the request body. The call is working with Postman but I can't figure out how to make it work with the Wizard or by editing the XML file. I believe I need to make the query in the Message attribute of the Request Element, but... The documentation says it is not the way for a GET request. Please help. This is my query...

{
"query": {
"meta_value": "5555555555",
"meta_key": "mobile_phone",
"meta_compare": "=",
"limit": 1
}
}

How do I pass this with the [Number] Variable via a JSON HTTP GET request?

Thanks!

AL
 
I would suggest that you check our Hubspot template as this is a method we use for the contact lookup. You will see that in the template we use the below:

<Request SkipIf="[IIf([FoundRecordCount]&gt;0,True,False)]"
Url="https://api.hubapi.com/crm/v3/objects/contacts/search"
RequestEncoding="Json" RequestType="Post" ResponseType="Json" >
<PostValues>
<Array Key="properties">
<Value>firstname</Value>
<Value>lastname</Value>
<Value>company</Value>
<Value>email</Value>
<Value>phone</Value>
<Value>mobilephone</Value>
<Value>fax</Value>
</Array>
<Array Key="filterGroups">
<Object>
<Array Key="filters">
<Object>
<Value Key="propertyName" Type="String">phone</Value>
<Value Key="operator" Type="String">EQ</Value>
<Value Key="value" Type="String">[Number]</Value>
</Object>
</Array>
</Object>
<Object>
<Array Key="filters">
<Object>
<Value Key="propertyName" Type="String">mobilephone</Value>
<Value Key="operator" Type="String">EQ</Value>
<Value Key="value" Type="String">[Number]</Value>
</Object>
</Array>
</Object>
<Object>
<Array Key="filters">
<Object>
<Value Key="propertyName" Type="String">fax</Value>
<Value Key="operator" Type="String">EQ</Value>
<Value Key="value" Type="String">[Number]</Value>
</Object>
</Array>
</Object>
</Array>
</PostValues>
</Request>

In the PostValues item inside the Request element, will be converted to JSON when RequestEncoding="Json"
They you can create objects, arrays or values.
 
Thanks for the reply. I tried that approach. (I may have had errors) but we are doing a GET request and not a POST. Not sure if that is a factor or not?

Here is what I had...

Code:
<Request SkipIf="" Url="https://www.ottawatravelagents.ca/wp-json/gh/v3/contacts" MessagePasses="0" Message="" RequestEncoding="Json" RequestType="Get" ResponseType="Json">
<PostValues>
<Array Key="query">
<Value Key="meta_value" Type="String">[Number]</Value>
<Value Key="meta_key" Type="String">mobile_number</Value>
<Value Key="meta_key" Type="String">mobile_number</Value>
<Value Key="meta_compare" Type="String">=</Value>
<Value Key="limit" Type="String">1</Value>
</Array>
</PostValues>
</Request>
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,973
Messages
590,075
Members
164,895
Latest member
jasonkkrause