APIs & Integrations

kazufumi
Participant

response data is not JSON

Hi,

I call API to get read all properties.

https://developers.hubspot.jp/docs/api/crm/properties

 

I expect response data is JSON format but not response data is JSON format. 
Is my code  something wrong ??
 
python version is 3.9.1
I use PowerShell and Ubuntsu. response data is same.
 

my code 

 

 

 

import hubspot
from pprint import pprint
from hubspot.crm.properties import ApiException
import json

client = hubspot.Client.create(api_key="XXXXXXXXXXXX")

try:
    api_response = client.crm.properties.core_api.get_all(object_type="companies", archived=False)
    strings = str(api_response)
    with open('all_propaties.json', 'w', encoding="utf-8") as f:
        f.write(strings)
       
       
except ApiException as e:
    print("Exception when calling core_api->get_all: %s\n" % e)

 

 

 

 

response data

 

 

 

{'paging': None,
 'results': [{'archived': None,
              'archived_at': None,
              'calculated': False,
              'created_at': datetime.datetime(2019, 8, 6, 2, 41, 46, 48000, tzinfo=tzutc()),
              'created_user_id': None,
              'description': 'Short about-company',
              'display_order': -1,
              'external_options': False,
              'field_type': 'text',
              'form_field': False,
              'group_name': 'companyinformation',
              'has_unique_value': False,
              'hidden': False,
              'hubspot_defined': True,
              'label': 'About Us',
              'modification_metadata': {'archivable': True,
                                        'read_only_definition': True,
                                        'read_only_options': None,
                                        'read_only_value': False},
              'name': 'about_us',
              'options': [],
              'referenced_object_type': None,
              'show_currency_symbol': None,
              'type': 'string',
              'updated_at': datetime.datetime(2022, 5, 27, 22, 46, 58, 812000, tzinfo=tzutc()),
              'updated_user_id': None},
・
・
・
・
}]}

 

 

 

I expect this format

 

 

 

{
  "results": [
    {
      "groupName": "contactinformation",
      "hidden": false,
      "modificationMetadata": {
        "readOnlyOptions": false,
        "readOnlyValue": false,
        "readOnlyDefinition": false,
        "archivable": true
      },
      "name": "my_contact_property",
      "displayOrder"
・
・
・
    }
  }
}

 

 

 

0 Upvotes
3 Replies 3
JPanama
HubSpot Moderator
HubSpot Moderator

response data is not JSON

Hi @kazufumi

 

I have sent you a DM on this.


Best, 
Joe (HubSpot Moderator) 

0 Upvotes
HammadChaudhry
Member

response data is not JSON

Hi JPanama,


I'm facing the same issue. Would you please share the solution here?


Best,
Hammad

0 Upvotes
WFKent
Member

response data is not JSON

Hi Joe,

I'm experiencing the same issue, can I get a copy of the DM that you sent Kazafumi?

Cheers,

Jon

0 Upvotes