XF 2.2 Fill multi-value custom thread field using API

DNF-SaS

New member
Hi,

can anybody give a cURL-example how to fill a multi-value custom thread field using the REST-API?
A single value works, but when using multiple values, only the last one get stored.

Thanks
Sascha
 
Untestested

Code:
custom_fields[fieldname][]=fieldvalue1&custom_fields[fieldname][]=fieldvalue2&custom_fields[fieldname][]=fieldvalue3
 
Last edited:
Here's to my fellow strugglers:

Download Postman - you need it, trust me.
Start Here: How to call the XenForo API
He put a good guide together for different scenarios.
I really didn't have a clue about this stuff:

I wanted to POST to a thread using another app/webhook.
Basically, from that app I submit a form, the form calls a .php file that contains the code used to create a new Thread in Xenforo. Six hours later it worked. I'm a fast learner ;) .
Postman provides the code/request you want.
You can create collections of your API calls etc. It's pretty sweet.

Now there may be some gaps from the Resource I'm pointing you too, you'll need to just keep looking through it, you may miss something. Here's a couple other good resources.
Some Tips
You need to create/get your API Key from Xenforo
Determine what you want. My case I wanted to create a New Thread in a Forum.

Get your url in Postman right.
Starting it should be clean, no ? or &: This was mine:

Next comes the Params, go to the tab in Postman:
Key = node_id
Value = 2 (this has to be a number, look at your forum it will be in the url ex. forumname.4)
Url should looks like this:

Next Go to Body Tab
(Important - Select Radio Button: x-www-form-urlencoded)
Key = title
Value = Test Title

Key = message
Value = Test Message

No quote marks, just clean text.

Test, adjust, once you get a success message.
Look to the right in Postman and find the Code </> icon,
Select PHP or however you want to copy your Request.

It will give you the php code for the request. Copy it, create a blank .php document upload it to your server
and use that url to hit it when you are using the Webhook.

Goodluck, there's so many ways to accomplish this with so many ways to make a mistake, yay coding.
This is what worked for me.

Thanks to everyone who has taken the time and will take the time to share your notes and save others a little more life. Nice community!
I hate ie6.
 
Last edited:
Back
Top Bottom