Skip to main content
FMEEvangelist
Helper ⭐️⭐️
Jan 28, 2025 5:59 PM UTC
Solved

Closing a question with the API

Is there a special trick to closing a question with the API? Maybe a typo in the documentation? I’m really having trouble getting it to work. All I get is a 401 (Unauthorized) error.

I’d appreciate any suggestions. This one is just confusing me! Screenshots below.

Cheers

Mark

 

 

 

FMEEvangelist
Helper ⭐️⭐️
Jan 28, 2025 8:42 PM UTC

 Thanks ​@DannyPancratz - I agree, the two different Ids are a little annoying. But that wasn’t the problem. The problem is I was attempting to use the wrong server. I just Googled for insided api and copied the URL from the documentation. But when I noticed the URL looked odd, I went back to my Google search:

 

The different results had a different URL! So, today’s lesson is to make sure to pick the documentation for the correct server. I assume it’s all the same content, except for the URLs that it quotes. 

Doh! Hopefully I won’t do that again. Thanks for taking the time to respond. 

Ask me about all things spatial!

4 replies

DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
Jan 28, 2025 6:24 PM UTC

 

{
"closed": true
}

The documentation shows false, but that’s just an example of how to toggle it via the API. It needs to be true to close it. False opens it back up. 

Translate
FYI: I am no longer active in this community
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
Jan 28, 2025 6:27 PM UTC

But that doesn’t solve your issue with the Unauthorized. 

Here’s what it is: the question has two different Ids (big pain point for me). 

There’s a questionId and a topicId and sometimes there is a public version of the topicId. 

My guess is that you’re using the wrong Id and it’s trying the call on a question that doesn’t exist (often topicId is larger than questionId because it combines all types of topics in the index) so it can’t close a question that it can’t find. 

Translate
FYI: I am no longer active in this community
FMEEvangelist
FMEEvangelistAuthorAnswer
Helper ⭐️⭐️
Jan 28, 2025 8:42 PM UTC

 Thanks ​@DannyPancratz - I agree, the two different Ids are a little annoying. But that wasn’t the problem. The problem is I was attempting to use the wrong server. I just Googled for insided api and copied the URL from the documentation. But when I noticed the URL looked odd, I went back to my Google search:

 

The different results had a different URL! So, today’s lesson is to make sure to pick the documentation for the correct server. I assume it’s all the same content, except for the URLs that it quotes. 

Doh! Hopefully I won’t do that again. Thanks for taking the time to respond. 

Translate
Ask me about all things spatial!
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
Jan 28, 2025 9:35 PM UTC

I’m glad you figured it out! 

Translate
FYI: I am no longer active in this community