APIs & Integrations

AAbdullayev
Membro

Filters in properties endpoint

resolver

Hello,

I want to get specific properties by filter formField=true and group(or groupName)=companyinformation.
But /crm/v3/properties/Companies/search not working, so maybe somebody have an idea. but api solutions only, because I currently use  after request handling.

my current request

GET {{HUBSPOT}}/crm/v3/properties/Companies?properties=name&properties=label&properties=fieldType&properties=groupName&archived=false&properties=formField&group=companyinformation

0 Avaliação positiva
1 Solução aceita
klloyd__1
Solução
Participante | Parceiro Ouro
Participante | Parceiro Ouro

Filters in properties endpoint

resolver

Thanks for the tag @Jaycee_Lewis 

 

@AAbdullayev it does not appear that there is a property group filter for the properties endpoint.  You can either get specific properties (like you're doing now), or use the get all company properties endpoint (essentially the same thing just without ?properties= parameters).

 

What I would recommend is use the get all properties endpoint, then loop through the results to return properties where groupname=companyinformation and formField = true.  I always use Python code, and to do that I would do something like this:

 

import requests
import json
url = "https://api.hubapi.com/crm/v3/properties/comapnies"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
response_json = response.json()
all_properties = response_json['results']
companyinformationprops = []
for property in all_properties:
    if property['groupName'] == "companyinformation" and property['formField'] is False:
        companyinformationprops.append(property)

 

This will leave you with a list of just the properties from the company information group and are set as form fields.

 

I agree it would be better if these filters could be added directly to the URL request, but this is my best workaround.  Please let me know if this helps!

Exibir solução no post original

4 Respostas 4
klloyd__1
Solução
Participante | Parceiro Ouro
Participante | Parceiro Ouro

Filters in properties endpoint

resolver

Thanks for the tag @Jaycee_Lewis 

 

@AAbdullayev it does not appear that there is a property group filter for the properties endpoint.  You can either get specific properties (like you're doing now), or use the get all company properties endpoint (essentially the same thing just without ?properties= parameters).

 

What I would recommend is use the get all properties endpoint, then loop through the results to return properties where groupname=companyinformation and formField = true.  I always use Python code, and to do that I would do something like this:

 

import requests
import json
url = "https://api.hubapi.com/crm/v3/properties/comapnies"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
response_json = response.json()
all_properties = response_json['results']
companyinformationprops = []
for property in all_properties:
    if property['groupName'] == "companyinformation" and property['formField'] is False:
        companyinformationprops.append(property)

 

This will leave you with a list of just the properties from the company information group and are set as form fields.

 

I agree it would be better if these filters could be added directly to the URL request, but this is my best workaround.  Please let me know if this helps!

AAbdullayev
Membro

Filters in properties endpoint

resolver

okay, thanks. Now is working like that.
I was hoping there would be a filter 🙂

0 Avaliação positiva
klloyd__1
Participante | Parceiro Ouro
Participante | Parceiro Ouro

Filters in properties endpoint

resolver

Oops, meant to write property['formField'] is True

0 Avaliação positiva
Jaycee_Lewis
Gerente da Comunidade
Gerente da Comunidade

Filters in properties endpoint

resolver

Hi, @AAbdullayev 👋 Welcome to the community! Hey, @Ismail @klloyd__1, do you have any tips on how @AAbdullayev can structure their request?

 

Thank you very much! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Avaliação positiva