# SImple API Call

**URL:** <https://community.hubspot.com/t/simple-api-call/33065>\
**Category:** APIs & Integrations\
**Tags:** cms-content\
**Created:** [March 12, 2021, 12:42am UTC](https://community.hubspot.com/t/simple-api-call/33065 "2021-03-12T00:42:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [March 12, 2021, 12:42am UTC](https://community.hubspot.com/t/simple-api-call/33065/1 "2021-03-12T00:42:07Z")

</div>

Hi guys - I am simply trying to make an API call in 1 or 2 steps and heres what I’m trying to do:

1. Search for a contact in hubspot based on a property - Email ( I will do this on the front end)
2. My back end will make an API call request to hubspot and if the value was found within an object or contact, then I will return the rest of the information on the front end
3. If it is not found, then I will create a new one

This is easy with zapier, and I want to create it on my back end through Xano..

I thought it would be the READ request but the contact ID is needed to perform the operation: ( **GET** /crm/v3/objects/contacts/{contactId})

The SEARCH request seems like it would work, and I can get a 200 request in whcih is sees the object, but I cannot get it to return/show the results I’d like to ( **POST** /crm/v3/objects/contacts/search)

Please advise on the function stack or CURL requests needed or exact API endpoint I should use to do this…

Thanks in advance - Jon

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 15, 2021, 6:28pm UTC](https://community.hubspot.com/t/simple-api-call/33065/2 "2021-03-15T18:28:41Z")

</div>

Hey @JNeal

Have you taken a look at the batch read endpoint?

Post request here: **[https://api.hubapi.com/crm/v3/objects/contacts/batch/read](https://api.hubapi.com/crm/v3/objects/contacts/batch/read)**

Your body would look like this:

```lia-code-sample
{
 "properties": [
 "email",
 "firstname"
 ],
 "idProperty": "email",
 "inputs": [
 {
 "id": "email@email.com"
 }
 ]
}

```

In the properties array, you can add whatever properties you would like returned

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [April 6, 2021, 4:14am UTC](https://community.hubspot.com/t/simple-api-call/33065/3 "2021-04-06T04:14:30Z")

</div>

Hey Denis - Thank you so much for this help! This is what I was looking for!  
Though I can see that it works and calls the correct properties that I  
input in the hubspot test environment, I went to add the following CURL to  
my connect my API on the front end and it was not able to recognize the URL  
for some reason.. See below screenshot…  
[image: Screen Shot 2021-04-05 at 11.08.14 PM.png]  
Any ideas here? I tried removing the “archived=false” part to no avail. The  
actual error that occurs when I go to initialize the call is that it says  
“URL is not correct”…  
Thanks in advance - Jon

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [April 6, 2021, 1:06pm UTC](https://community.hubspot.com/t/simple-api-call/33065/4 "2021-04-06T13:06:32Z")

</div>

Hey @JNeal

That screengrab did not come through. Mind trying again 😀

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [April 6, 2021, 6:08pm UTC](https://community.hubspot.com/t/simple-api-call/33065/5 "2021-04-06T18:08:31Z")

</div>

attached

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 17, 2021, 10:42pm UTC](https://community.hubspot.com/t/simple-api-call/33065/6 "2021-06-17T22:42:06Z")

</div>

Hey Denis - Quick followup here…

How can I “update a contact” in the following manner..

Search hubspot using the “email” value to find the contact… then update a contact property with the value?

thanks - Jon

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 18, 2021, 4:23pm UTC](https://community.hubspot.com/t/simple-api-call/33065/7 "2021-06-18T16:23:49Z")

</div>

Hi @JNeal

Have you happened across [this endpoint](https://legacydocs.hubspot.com/docs/methods/contacts/update_contact-by-email)? Seems to fit the bill 😀

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 18, 2021, 4:33pm UTC](https://community.hubspot.com/t/simple-api-call/33065/8 "2021-06-18T16:33:40Z")

</div>

Thanks for this Denni! Where has that developer page been at 🙂

I’ve been working off this one and that endpoit was not listed - [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/contacts)

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 18, 2021, 4:56pm UTC](https://community.hubspot.com/t/simple-api-call/33065/9 "2021-06-18T16:56:47Z")

</div>

@JNeal

Apologies for that…The legacy docs are slowly being migrated into the newer developer docs as the APIs are upgraded. Don’t worry that they are under a legacy domain name! They are stable and fully supported unless explicitely indicated

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 18, 2021, 11:30pm UTC](https://community.hubspot.com/t/simple-api-call/33065/10 "2021-06-18T23:30:41Z")

</div>

No problem and yes that endpoint seems tot be the right one, however, I am gettign 400 error that doesnt make sense.. This is the error message provided by the back end… I have everything I can think of configured correctly but it says that the “property cannot be missing or null”… Above in the request we can see that the “phone number” field has a value there, so im not sure which property it is referrring to? The contact with that email is in hubspot and its jsut not passing along the phone #… Any ideas?

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 19, 2021, 8:23pm UTC](https://community.hubspot.com/t/simple-api-call/33065/11 "2021-06-19T20:23:16Z")

</div>

As requested here is the json - I removed the api key…

 ![XANO.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/25a33edde7d5ea3631c5d8bf3e0d90ba67de3798.jpeg)

Here is the raw request:

{“request”:{“url”:“[https://api.hubapi.com/contacts/v1/contact/email/XANO@XANOPOST.COM/profile?hapikey=(REMOVED)",“method”:“POST”,“headers”:\["POST](https://api.hubapi.com/contacts/v1/contact/email/XANO@XANOPOST.COM/profile?hapikey=(REMOVED)%22,%22method%22:%22POST%22,%22headers%22:%5C%5B%22POST) /contacts/v1/contact/email/XANO@XANOPOST.COM/profile?hapikey=(REMOVED) HTTP/2”,“Host: [api.hubapi.com](http://api.hubapi.com)”,“accept-encoding: gzip, deflate”,“content-type: application/json”,“accept: application/json”,“content-length: 37”],“params”:“{\“properties\”:{\“phone\”:\“7742125654\”}}”},“response”:{“headers”:[“HTTP/2 400”,“date: Sat, 19 Jun 2021 20:15:52 GMT”,“content-type: application/json;charset=utf-8”,“content-length: 120”,“cf-ray: 661f6e8f8f5a2cb3-ORD”,“strict-transport-security: max-age=31536000; includeSubDomains; preload”,“vary: Accept-Encoding”,“cf-cache-status: DYNAMIC”,“access-control-allow-credentials: false”,“cf-request-id: 0ac7836db500002cb3b8a06000000001”,“expect-ct: max-age=604800, report-uri=\”[[https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\](https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct%5C%5C)]([https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\](https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct%5C))“”,“x-hubspot-correlation-id: 854a27da-26f7-459e-9abb-8c56a2948490”,“x-hubspot-ratelimit-daily: 500000”,“x-hubspot-ratelimit-daily-remaining: 499999”,“x-hubspot-ratelimit-interval-milliseconds: 10000”,“x-hubspot-ratelimit-max: 150”,“x-hubspot-ratelimit-remaining: 149”,“x-hubspot-ratelimit-secondly: 15”,“x-hubspot-ratelimit-secondly-remaining: 14”,“x-trace: 2BB11EC654FEF4487E6E074E1EB9A8F823FC771BAA000000000000000000”,“report-to: {\“endpoints\”:[{\“url\”:\“https:\\/\\/a.nel.cloudflare.com\\/report\\/v2?s=47g5mhhMI9qMnSBYjhFMmUUJptINvhBgkUdOJGst2tSX5qKfwnsbNuKq1RUt2%2FPrMJi%2FoEQC1xKjsLHIfIGb4FWvvpiMJ4Go2VxSW0e%2FeujV86BUlEWXSyuh0A%3D%3D\”}],\“group\”:\“cf-nel\”,\“max\_age\”:604800}”,“nel: {\“report\_to\”:\“cf-nel\”,\“max\_age\”:604800}”,“server: cloudflare”,“alt-svc: h3-27=\”:443\“; ma=86400, h3-28=\”:443\“; ma=86400, h3-29=\”:443\“; ma=86400, h3=\”:443\“; ma=86400”],“result”:{“status”:“error”,“message”:“property cannot be missing or null”,“correlationId”:“854a27da-26f7-459e-9abb-8c56a2948490”},“status”:400}}

Here is how we have the body set up in XANO (the back end platform)

 ![Screen Shot 2021-06-19 at 3.21.43 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/9/9f214ac347006698a3abca6b35f489f3126401c5.png)

 ![Screen Shot 2021-06-19 at 3.22.53 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/5/54d4f9361f1e2b3b319e31ac8dc8ceffac856993.png)

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 21, 2021, 5:28pm UTC](https://community.hubspot.com/t/simple-api-call/33065/12 "2021-06-21T17:28:26Z")

</div>

Any thoughts Denis?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 29, 2021, 3:24pm UTC](https://community.hubspot.com/t/simple-api-call/33065/13 "2021-06-29T15:24:09Z")

</div>

@JNeal , Sorry for leaving you hanging. Was out on vacation. Did you get this resolved?

---

<div class="post-metadata">

**Author:** ![JNeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jneal/32/41549_2.png) [@JNeal](https://community.hubspot.com/u/JNeal)\
**Post date:** [June 29, 2021, 3:39pm UTC](https://community.hubspot.com/t/simple-api-call/33065/14 "2021-06-29T15:39:29Z")

</div>

Yes figured it out thanks!

My back end guys just said that you had your code arrannged in a weird way, so he had to change a few things to get it to work but seems to work as planned
