Unlist a topic via an API request


(Julien Russo) #1

Hello, I have a question. I try to unlist a topic from a category using the API.

When I try to call this request:

{{base_url}}/t/my-super-topic/12/status?api_key={{api_key}}&api_username={{api_username}}

using a PUT request with the following form-data params:

status: visible, enabled: false

I got a 400 - Bad request error.

This is exactly the same request applied when I unlist the topic via the web interface.
Is there any issue with the API call ?

Thanks !


(Blake Erickson) #2

Are you able to get any other PUT/POST requests to work on other endpoints? Possibly the content-type is not set to “multipart/form-data”?

I was able to get it to work with this curl request:

curl -X PUT "https://url/t/topic-title/17/status" \
-H "Content-Type: multipart/form-data;" \
-F "api_key=apikey" \
-F "api_username=username" \
-F "status=visible" \
-F "enabled=false"

(Julien Russo) #3

Hello Blake and thank you for your answer.
Yes, others queries work perfectly.
To test the queries, I use postman and then I use a PHP API with curl.
As this one didn’t work in postman, I didn’t try with curl, but if you tell me it works fine, I think the issue is fixed :slight_smile:

I’m gonna try by myself and I’ll tell you if it’s okay.
Thanks again !


(Julien Russo) #4

Hello Blake, it worked perfectly with curl, thanks you very much for you help !