Unlist a topic via an API request

AI-generated summary

julienrusso encountered a 400 - Bad request error when attempting to unlist a topic via the API using a PUT request with form-data params. blake suggested trying a different content-type and provided a working curl request example. After testing, julienrusso confirmed that other API requests worked fine and planned to try blake’s solution. Ultimately, julienrusso successfully unlisted the topic using curl, thanking blake for the assistance.

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 !

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"

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 !

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