Unlist a topic via an API request

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 !

2 Likes

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"
6 Likes

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 !

1 Like

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

1 Like