XF 2.2 Threads tags via API

Dashti

New member
Hi,

I use POST /thread endpoint to create a new thread. However I cannot add tags with this call. Can someone explain how to add tags to a thread?

ex:

Code:
POST {{baseUrl}}threads
    ?node_id=2
    &tags=inv
    &title=title
    &message=message
Content-Type: application/x-www-form-urlencoded
XF-Api-Key: {{apiKey}}
XF-Api-User: {{userId}}
 
The tags parameter has to be passed as an array.

InputTypeDescription
node_idintegerID of the forum to create the thread in.
titlestringTitle of the thread.
messagestringBody of the first post in the thread.
discussion_typestringThe type of thread to create. Specific types may require additional input.
prefix_idintegerID of the prefix to apply to the thread. If not valid in the selected forum, will be ignored.
tagsstring[]Array of tag names to apply to the thread.
custom_fields[<name>]stringValue to apply to the custom field with the specified name.
discussion_openbool
stickybool
attachment_keystringAPI attachment key to upload files. Attachment key context type must be post with context[node_id] set to the ID of the forum this is being posted in.
 
Thank you for your response,

I tried difference approaches like:
  • &tags=[val1,val2]
  • &tags=val1,val2
  • &tags=val1&tags=val2
however none of them works.
Do you have an example?
 
Thank you for your response,

I tried difference approaches like:
  • &tags=[val1,val2]
  • &tags=val1,val2
  • &tags=val1&tags=val2
however none of them works.
Do you have an example?
If you are building a URL manually I think you have to send it into the request already encoded. This format is correct: &tags=val1&tags=val2 and encoded it looks something crazy like:

tags%5B0%5D=val1&tags%5B1%5D=val2
 
Top Bottom