Skip to content

Create Document, tabs parameter not respected #2559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kbridbur opened this issue Jan 30, 2025 · 1 comment
Open

Create Document, tabs parameter not respected #2559

kbridbur opened this issue Jan 30, 2025 · 1 comment
Labels
needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@kbridbur
Copy link

kbridbur commented Jan 30, 2025

Environment details

  • OS type and version: Mac, Apple M3 Max
  • Python version: 3.12.8
  • pip version: 24.3.1
  • google-api-python-client version: 2.160.0

Steps to reproduce

  1. Structure a create document request with any number of tabs in the tabs field
  2. Send request
  3. The request is valid and a document is created, but the document does not have any tabs other than the default "Tab 1"

Code example

from google.oauth2 import service_account
from googleapiclient.discovery import build
import json

SCOPES = ['https://www.googleapis.com/auth/documents']
SERVICE_ACCOUNT_FILE = './credentials.json'

credentials = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES
)

docs_service = build('docs', 'v1', credentials=credentials)
request = {
    "title": "test",
    "tabs": [
        {
            "tabProperties": {
                "title": "test tab",
                "index": 0
            },
            "documentTab": {
                "body": {}
            }
        },
        {
            "tabProperties": {
                "title": "test tab2",
                "index": 1
            },
            "documentTab": {
                "body": {}
            }
        }
    ]
}

response = self.docs_service.documents().create(
            body=request).execute()
print(response["documentId"])
print(json.dumps(response["tabs"], indent=4))

See that only the default tab exists. If any names of parameters are changed/etc you will receive a 400 error which indicates that the client is indeed parsing the tabs parameter provided, but nothing appears to be done with it

@vchudnov-g
Copy link
Contributor

Thanks for reporting this issue! This sounds like a server endpoint issue rather than a client library issue. Do you get the same error if you use the APIs Explorer on the right-hand sidefbar of this page? Do you get the same error if you try this request from the terminal using curl?

@vchudnov-g vchudnov-g added needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 24, 2025
@vchudnov-g vchudnov-g removed their assignment Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants