# I am unable to add multiple properties to an API request (Python)

**URL:** <https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [June 3, 2021, 3:52pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364 "2021-06-03T15:52:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![VDrigin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vdrigin/32/78108_2.png) [@VDrigin](https://community.hubspot.com/u/VDrigin)\
**Post date:** [June 3, 2021, 3:52pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/1 "2021-06-03T15:52:45Z")

</div>

I am trying to extract company data with multiple properites, but I can only add one property to one request.

max\_results = 500  
hapikey = ‘\*\*\*’  
limit = 250  
property\_list = []  
property\_list.append(‘name’)  
**properties = ‘’**  
company\_list = []  
get\_all\_companies\_url = “[https://api.hubapi.com/companies/v2/companies/paged?](https://api.hubapi.com/companies/v2/companies/paged?)”  
parameter\_dict = {‘hapikey’: hapikey, ‘limit’: limit, **‘properties’: properties}**  
headers = {}

# Paginate your request using offset  
has\_more = True  
while has\_more:  
parameters = urllib.parse.urlencode(parameter\_dict)  
get\_url = get\_all\_companies\_url + parameters  
r = requests.get(url= get\_url, headers = headers )  
response\_dict = json.loads(r.text)  
has\_more = response\_dict[‘has-more’]  
company\_list.extend(response\_dict[‘companies’])  
parameter\_dict[‘offset’]= response\_dict[‘offset’]  
if len(company\_list) \>= max\_results: # Exit pagination, based on whatever value you’ve set your max results variable to.  
print(‘maximum number of results exceeded’)  
break  
print(‘loop finished’)

list\_length = len(company\_list)

print(“You’ve succesfully parsed through {} company records and added them to a list”.format(list\_length))

---

<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 3, 2021, 6:37pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/2 "2021-06-03T18:37:19Z")

</div>

I bet @taran42 can help out here 😀

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [June 3, 2021, 6:49pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/3 "2021-06-03T18:49:15Z")

</div>

@dennisedson Actually, I can. 🙂

@VDrigin You want to get your company properties through URL parameters. See below.

`get_all_companies_url = "https://api.hubapi.com/companies/v2/companies/paged?&properties=property1&properties=property1&"`

You’ll want to remove that bit of _properties_ code you have under your _parameter\_dict_.

---

<div class="post-metadata">

**Author:** ![VDrigin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vdrigin/32/78108_2.png) [@VDrigin](https://community.hubspot.com/u/VDrigin)\
**Post date:** [June 4, 2021, 9:42am UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/4 "2021-06-04T09:42:46Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![VDrigin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vdrigin/32/78108_2.png) [@VDrigin](https://community.hubspot.com/u/VDrigin)\
**Post date:** [June 15, 2021, 2:39pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/5 "2021-06-15T14:39:24Z")

</div>

Hi,

I am facing different issue, I can access multilpe properties now, but not all of them.

It seems like I do not know API names for them. For example, I can not access ‘Last activity date’.

---

<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 15, 2021, 2:42pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/6 "2021-06-15T14:42:52Z")

</div>

@VDrigin ,

Two methods of getting the property internal names

1. [through the properties api](https://developers.hubspot.com/docs/api/crm/properties)

2. [Via the Portal UI](https://knowledge.hubspot.com/crm-setup/manage-your-properties)

---

<div class="post-metadata">

**Author:** ![VDrigin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vdrigin/32/78108_2.png) [@VDrigin](https://community.hubspot.com/u/VDrigin)\
**Post date:** [June 15, 2021, 4:22pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/7 "2021-06-15T16:22:24Z")

</div>

Thank you, that works.

Now I am facing a different issue as ‘Last activity date’ I am getting numbers such as 1623062746000.

I have no idea what they mean and how to convert them to dates. At first I thought those were datetimestamps, but python does not understand them.

Could you advise how to covrert those numbers to dates, ideally in Python?

Thank you!

---

<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 15, 2021, 5:13pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/8 "2021-06-15T17:13:53Z")

</div>

@VDrigin

That is unix time code in milliseconds which is the typical method HubSpot will return dates

@taran42 is my go to for these types of questions. Gonna make a [Community Champion](https://offers.hubspot.com/community-champions) out of you yet 😜

I did a quick google as python is not in my vocabularly, sadly

Here is what I got. @taran42 , correct whatever is wrong

```lia-code-sample
import datetime
print(
 datetime.datetime.fromtimestamp(
 int("1284105682")
 ).strftime('%Y-%m-%d %H:%M:%S')
)

```

---

<div class="post-metadata">

**Author:** ![VDrigin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vdrigin/32/78108_2.png) [@VDrigin](https://community.hubspot.com/u/VDrigin)\
**Post date:** [June 16, 2021, 8:31am UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/9 "2021-06-16T08:31:35Z")

</div>

I have tried the code above before.

Python does not understand this timestamp.

Thank you for your time! HubSpot Community is really supportive 😊

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [June 16, 2021, 2:54pm UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/10 "2021-06-16T14:54:51Z")

</div>

@dennisedson Does that mean I’ll be making the big bucks, like you? 😄

@VDrigin What Dennis posted is correct. I threw it into a quick script and got the proper output. See below.

 ![image.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/7/d729111476c9db9cddbcfed88be806c2b3bd5a37.png)

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [June 7, 2021, 11:06am UTC](https://community.hubspot.com/t/i-am-unable-to-add-multiple-properties-to-an-api-request-python/38364/11 "2021-06-07T11:06:05Z")

</div>

Hi @VDrigin ,  
Please check and use this :  
Add properties with url for fetching.  
Example 1 for fetch properties with single  
\<?php  
$get\_all\_companies\_url = “[https://api.hubapi.com/companies/v2/companies/paged?properties=name&properties=xvz](https://api.hubapi.com/companies/v2/companies/paged?properties=name&properties=xvz)”  
?\>  
OR  
if you want more properties details for that then fetch full contacts details usings loop.  
\<?php  
foreach($get\_all\_companies\_url as $k =\> $val){  
$vid = $val-\>vid;  
$get\_all\_companies\_url = “[https://api.hubapi.com/contacts/v1/contact/vid/“.$vid.”/profile?hapikey=demo](https://api.hubapi.com/contacts/v1/contact/vid/%22.$vid.%22/profile?hapikey=demo)”;  
}  
?\>

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.  
Thanks and Regards.
