Discussions
Trouble with API SDK and Website API examples
Hey ClickFunnels Engineering team,
In the OpenAPI v3.1.0 specs, according to the parameters styles , serializing arrays in the parameter to comma separated lists is supported, so this looks like it should work
// ...
{
"email_address": {
"type": "array",
"items": {
"type": "string"
},
"example": "[email protected],[email protected]"
},
}
// ...
However, the API SDK and your website don't serialize the parameters according to that specification. I believe it might be related to how the array is nested inside of an object. That might be overriding the default behavior since it has to deal with nested keys rather than "lists".
As a result, the SDK and your website end up serializing it as this.
...filter[email_address][0]=example%40email.com'
This is not the case for every OpenAPI/Swagger tool I tested, but the one I have when I run
npm install api
npx install @cf2/v2#1q7w4glua6irvo
To throw another wrench into things, the example
property is a single string, not an array.
And if I use the SDK with a string instead of an array, it works, but type safety complains a lot.
So, I guess I'm asking if you can please update your OpenAPI documentation to acknowledge that you don't technically take an array, you take a formatted string. That will at least be supported by all implementations.
Something like
{
"email_address": {
"type": "string",
"description": "Comma separated list of emails",
"example": "[email protected],[email protected]"
},
}