3

I'm trying to post an article using StackExchange's Teams API then try to pull that new article's id from the API response. The article gets posted but the items field is empty :

{"items":[], "has_more":false,"quota_max":10000,"quota_remaining":9999"}

This is weird because the docs state that the request is supposed to return an article block https://api.stackexchange.com/docs/create-article

What am I doing wrong? Here's my code (in Python):

import requests
base_url = "https://api.stackexchange.com/"
payload = {'title' : title, 'body' : body, 'article_type' : article_type, 'tags' : tags, 'key' : key, 'site' : 'stackoverflow', 'team' : team}
r = requests.post(base_url + "2.3/articles/add", headers = {"X-API-Access-Token" : access_token}, data = payload)
print(r.text)

Note that I've hidden only the variables I pass to the payload dictionary. But those variables are correct because as I said, the article gets posted successfully. I tried adding {"filter" : "default"} to the payload but I get the same response.

2
  • 1
    Hmmm ... the documentation says the API is read-only for Teams, so I'm surprised you can create an article in the first place.
    – Glorfindel
    Jan 21 at 15:59
  • 2
    @Glorfindel Perhaps that page of the API documentation is outdated? there are many POSTabilities in the Teams API. Such as add, edit and delete. Jan 21 at 16:07

1 Answer 1

4

The API for Teams behaves differently depending on the tier you're paying for:

  • Free tier - No API access
  • Basic tier - Read-only API access
  • Business tier - Read/Write API access

Additionally, only the Business tier has access to the Articles feature.

If you are using the Business tier of Teams, please open a ticket at s.tk/support and we can help you with this issue.

2
  • 1
    Welcome to Stack Apps and thanks for your answer! I've posted a follow-up question to add this information to the documentation.
    – Glorfindel
    Jan 31 at 15:16
  • Thanks for providing the answer, Juice (especially in the light of the concern about staff presence on Stack Apps I voiced elsewhere)! In the spirit of community-building, can we ask, should the OP open a support ticket, and the issue turns out to be reproducible after all, for a status update? Jan 31 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .