Here are the values for how_long_have_you_owned_your_home_:
1 – 5 Years 5 – 10 Years 10 – 15 Years 16+ Years I Do Not Own The Home I Live In. I Am Currently Building A New Home. I Am Looking To Purchase A New Home.
I have no problems if I add a value without any special characters (such as the last 4 items in the list). But if I try to add any value with a dash in it (such as the first 3 items in the list), I get an error similar to the one below:
"{"validationResults":[{"isValid":false,"message":"5 – 10 years was not one of the allowed options: [label: \"1 \\342\\200\\223\\302\\2405 years\"\nvalue: \"1 \\342\\200\\223\\302\\2405 years\"\ndisplay_order: 0\ndouble_da
ta: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"5 \\342\\200\\223\\302\\24010 years\"\nvalue: \"5 \\342\\200\\223\\302\\24010 years\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_onl
y: false\n, label: \"10 \\342\\200\\223\\302\\24015 years\"\nvalue: \"10 \\342\\200\\223\\302\\24015 years\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"16+ years\"\nvalue: \"16+ ye
ars\"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I do not own the home I live in.\"\nvalue: \"I do not own the home I live in.\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\
ndescription: \"\"\nread_only: false\n, label: \"I am currently building a new home.\"\nvalue: \"I am currently building a new home.\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I
am looking to purchase a new home.\"\nvalue: \"I am looking to purchase a new home.\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"how_long_have_you_owned_yo
ur_home_"}],"status":"error","message":"Property values were not valid","correlationId":"c4fdbba2-1e73-4677-8b24-6dcdbfc5b9b3"}"
As you can see, the dash (-) is being interpreted as:
Unable to udpate property via api with dash "-" in value
SOLVE
I have finally got to the bottom of this by brute force.
I compiled a very long list of potential values which included direct copy/pastes, utf-8 characters and html entities, each of which were subject to different iterations of escaping and encoding.
Then, using the api, I spammed hubspot with each value until one of them eventually worked.
As it turns out, there were actually two special characters in there:
\342\200\223
is octal for en-dash
\302\240
is octal for non-breaking-space
The special characters just needed to be sent as octal without any special escaping or encoding.
I'm sharing this here in case anyone else runs into this issue, as I don't believe this is documented anywhere and there are a bunch of related, unsolved issues lingering in the Community forums.
Unable to udpate property via api with dash "-" in value
SOLVE
I have finally got to the bottom of this by brute force.
I compiled a very long list of potential values which included direct copy/pastes, utf-8 characters and html entities, each of which were subject to different iterations of escaping and encoding.
Then, using the api, I spammed hubspot with each value until one of them eventually worked.
As it turns out, there were actually two special characters in there:
\342\200\223
is octal for en-dash
\302\240
is octal for non-breaking-space
The special characters just needed to be sent as octal without any special escaping or encoding.
I'm sharing this here in case anyone else runs into this issue, as I don't believe this is documented anywhere and there are a bunch of related, unsolved issues lingering in the Community forums.
{"validationResults":[{"isValid":false,"message":"1 – 5 years was not one of the allowed options: [label: \"1 \\342\\200\\223\\302\\2405 years\"\nvalue: \"1 \\342\\200\\223\\302\\2405 years\"\ndisplay_order: 0\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"5 \\342\\200\\223\\302\\24010 years\"\nvalue: \"5 \\342\\200\\223\\302\\24010 years\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"10 \\342\\200\\223\\302\\24015 years\"\nvalue: \"10 \\342\\200\\223\\302\\24015 years\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"16+ years\"\nvalue: \"16+ years\"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I do not own the home I live in.\"\nvalue: \"I do not own the home I live in.\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am currently building a new home.\"\nvalue: \"I am currently building a new home.\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am looking to purchase a new home.\"\nvalue: \"I am looking to purchase a new home.\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"how_long_have_you_owned_your_home_"}],"status":"error","message":"Property values were not valid","correlationId":"f93ebc88-a2c2-4163-a3d8-0c4fb58a0e51"}
If I post a value without an endash, the post is successful, there are no errors, and the changes are immediately reflected in my hubspot account.
I must say this is pretty frustrating. The issue has been open for 2 weeks, and I have no idea how to troubleshoot. What can be done to solve this?
@dennisedson, if I share my vid and hapikey with you, could you try posting to see if you get the same error?
curl Errors:
Status code: 400
Response: {"validationResults":[{"isValid":false,"message":"1 – 5 years was not one of the allowed options: [label: \"1 \\342\\200\\223\\302\\2405 years\"\nvalue: \"1 \\342\\200
\\223\\302\\2405 years\"\ndisplay_order: 0\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"5 \\342\\200\\223\\302\\24010 years\"\nvalue: \"5 \\
342\\200\\223\\302\\24010 years\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"10 \\342\\200\\223\\302\\24015 years\"\nval
ue: \"10 \\342\\200\\223\\302\\24015 years\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"16+ years\"\nvalue: \"16+ years\
"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I do not own the home I live in.\"\nvalue: \"I do not own the home I live i
n.\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am currently building a new home.\"\nvalue: \"I am currently building
a new home.\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am looking to purchase a new home.\"\nvalue: \"I am looking t
o purchase a new home.\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"how_long_have_you_owned_you
r_home_"}],"status":"error","message":"Property values were not valid","correlationId":"48f34ac4-04fe-4335-85bc-fdde95f4d02f"}
As previously stated, I have no problem submitting values without an en dash. For example, this works fine:
array(
'property' => 'how_long_have_you_owned_your_home_',
'value' => "I do not own the home I live in."
),
string(1556) "{"validationResults":[{"isValid":false,"message":"5 \\342\\200\\223\\302\\24010 years was not one of the allowed options: [label: \"1 \\342\\200\\223\\302\\2405 years\"\nvalue: \"1 \\342\\200\\223\\302\\2405 years\"\ndisplay_order: 0\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"5 \\342\\200\\223\\302\\24010 years\"\nvalue: \"5 \\342\\200\\223\\302\\24010 years\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"10 \\342\\200\\223\\302\\24015 years\"\nvalue: \"10 \\342\\200\\223\\302\\24015 years\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"16+ years\"\nvalue: \"16+ years\"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I do not own the home I live in.\"\nvalue: \"I do not own the home I live in.\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am currently building a new home.\"\nvalue: \"I am currently building a new home.\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"I am looking to purchase a new home.\"\nvalue: \"I am looking to purchase a new home.\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"how_long_have_you_owned_your_home_"}],"status":"error","message":"Property values were not valid","correlationId":"66e120a5-6db2-4efe-a7ee-73742bf6768e"}"
Pulling out the relevant parts of the error:
5 \\342\\200\\223\\302\\24010 years was not one of the allowed options 5 \\342\\200\\223\\302\\24010 years\"\nvalue: \"5 \\342\\200\\223\\302\\24010 years\"
Unable to udpate property via api with dash "-" in value
SOLVE
Hi Dennis!
I appreciate your response, but I'm not sure I understand what you're suggesting.
If you mean I should change the Internal Values, that is not an option. The Internal values can't be changed once they're in use (see screenshot attached).
Currently, they are in use by embedable js forms created by HubSpot.
What I am doing is building a separeate interface using the HubSpot API. As mentioned previously, this works perfectly as long as the property values don't have a dash in them.
So the question remains open: How can I send the following values via the api?