Greetings! I have a scenario where by I am attempting to use the HTTP module to retrieve an array of secondary_group_ids via the http module. I then use the tools function to add to the array an additional secondary_group_id, which works sucessfully
I then need to use the HTTP module to post a x-www-form-urlencoded message with the body of the message containing a key value pair for each element of the modified_secondary_group_ids, whereby the key is a static string “secondary_group_ids” and the value is the value of each element of the array. The body needs to contain all key, value pairs together when posting to the API. Similar to what is shown below
Really appreciate any advice that can be offered on how to properly format the http module to set the fields appropriately!
Hello @Kevin_K; I find HTTP POSTs tricky too.
Yet with a bit of processing, for the multiple array values we can submit them like so.
However, that example isn’t dynamic enough, and the blueprint below simulates your data to do so using an Iterator and Text Aggregator.
blueprint.json (13.2 KB)
Have fun!
That is awesome! I am so close, the text aggregator is now outputting dynamically generated secondary_group_ids as expected
However the Make a request module is expecting the query as an array.
I have tried converting to an array with the toArray() function to no avail - any words of wisdom?
@Kevin_K; please share the API documentation reference for that call.
Thank you so much for your time
Hello @Kevin_K, thanks for the API docs. Seeing integer[]
got me going back to basics with a refresher of passing arrays in a POST.
In searching further through XenForo, I see the CSV style of data passing.
So I’m wondering whether simple passing secondary_group_ids=61,56
has worked for you.
Thanks for the pointer, passing the following formats:
secondary_group_ids=61,56
secondary_group_ids=61,56
secondary_group_ids=61,secondary_group_ids=56
secondary_group_ids=61secondary_group_ids=56
all result in the error whereby qs is expecting an array - based on the error - is this the make http module returning the error and not actually the web server?
Did secondary_group_ids[]=61&secondary_group_ids[]=56
work?
Unfortunately no - that results in the same error
This is frustrating, and I’m not in a position to debug further.
Any luck getting the support team to send you an example of a similar request?
Finally got it to work!
Had to add an array aggregator into the mix to create an array with an appropriate key value pair.
2 Likes