APIs & Integrations

avyer
Participante | Parceiro Platinum
Participante | Parceiro Platinum

Read-only Properties on API

resolver

Hi,

 

I'd like to ask if there's a workaround on adding/updating option values of read-only definition properties (e.g., Lead Status, Lifecylce Stage). It can be done on hubspot UI, but using the API calls from the docs gives errors on read-only definition. Could it be done? We're trying to intergrate using the API after the client connects to the app.

0 Avaliação positiva
1 Solução aceita
lscanlan
Solução
Alunos da HubSpot
Alunos da HubSpot

Read-only Properties on API

resolver

Hi @avyer,

 

I did a search on the Community here for that error message and I found this thread: https://community.hubspot.com/t5/APIs-Integrations/Can-t-update-options-for-field-with-quot-optionsA..., where the poster was able to update the enumeration options by making a PATCH request instead of a PUT request. I'll see if I can get an update to our documentation for that, since I'm not actually seeing it documented. But in the meantime, you can try doing your updates that way. I believe you need to send all options in the request, as opposed to just the new option.

 

So for example you'd make a PATCH request to /properties/v1/contacts/properties/named/hs_lead_status, and then you could pass in a body of something like:

 

{
	"options": [
        {
            "label": "New",
            "displayOrder": 0,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "NEW"
        },
        {
            "label": "Open",
            "displayOrder": 1,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "OPEN"
        },
        {
            "label": "In Progress",
            "displayOrder": 2,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "IN_PROGRESS"
        },
        {
            "label": "Open Deal",
            "displayOrder": 2,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "OPEN_DEAL"
        },
        {
            "label": "Unqualified",
            "displayOrder": 3,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "UNQUALIFIED"
        },
        {
            "label": "Attempted to Contact",
            "displayOrder": 4,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "ATTEMPTED_TO_CONTACT"
        },
        {
            "label": "Connected",
            "displayOrder": 5,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "CONNECTED"
        },
        {
            "label": "Bad Timing",
            "displayOrder": 6,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "BAD_TIMING"
        },
        {
            "label": "A new status option",
            "displayOrder": 7,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": null,
            "value": "A_NEW_STATUS_OPTION"
        }
    ]
}

 

I hope that helps.

 

Leland Scanlan

HubSpot Developer Support

Exibir solução no post original

0 Avaliação positiva
2 Respostas 2
lscanlan
Solução
Alunos da HubSpot
Alunos da HubSpot

Read-only Properties on API

resolver

Hi @avyer,

 

I did a search on the Community here for that error message and I found this thread: https://community.hubspot.com/t5/APIs-Integrations/Can-t-update-options-for-field-with-quot-optionsA..., where the poster was able to update the enumeration options by making a PATCH request instead of a PUT request. I'll see if I can get an update to our documentation for that, since I'm not actually seeing it documented. But in the meantime, you can try doing your updates that way. I believe you need to send all options in the request, as opposed to just the new option.

 

So for example you'd make a PATCH request to /properties/v1/contacts/properties/named/hs_lead_status, and then you could pass in a body of something like:

 

{
	"options": [
        {
            "label": "New",
            "displayOrder": 0,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "NEW"
        },
        {
            "label": "Open",
            "displayOrder": 1,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "OPEN"
        },
        {
            "label": "In Progress",
            "displayOrder": 2,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "IN_PROGRESS"
        },
        {
            "label": "Open Deal",
            "displayOrder": 2,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "OPEN_DEAL"
        },
        {
            "label": "Unqualified",
            "displayOrder": 3,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "UNQUALIFIED"
        },
        {
            "label": "Attempted to Contact",
            "displayOrder": 4,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "ATTEMPTED_TO_CONTACT"
        },
        {
            "label": "Connected",
            "displayOrder": 5,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "CONNECTED"
        },
        {
            "label": "Bad Timing",
            "displayOrder": 6,
            "hidden": false,
            "readOnly": null,
            "doubleData": null,
            "description": null,
            "value": "BAD_TIMING"
        },
        {
            "label": "A new status option",
            "displayOrder": 7,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": null,
            "value": "A_NEW_STATUS_OPTION"
        }
    ]
}

 

I hope that helps.

 

Leland Scanlan

HubSpot Developer Support
0 Avaliação positiva
avyer
Participante | Parceiro Platinum
Participante | Parceiro Platinum

Read-only Properties on API

resolver

I was actually going to bring up the method because the update in the UI actually uses the PATCH request but I wasn't sure if its a viable method to be used for the API intergration. This works well, thank you for the reply.

0 Avaliação positiva