Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Template details irretrievable when field is None #26

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
Burhan-Q opened this issue Apr 9, 2024 · 0 comments
Open

Template details irretrievable when field is None #26

Burhan-Q opened this issue Apr 9, 2024 · 0 comments

Comments

@Burhan-Q
Copy link

Burhan-Q commented Apr 9, 2024

Error raised when requesting template details using python SDK but not when using requests. It would be nice to allow for arbitrary (especially when they might be unknown) fields to be null/None

Example with SDK

import pandadoc_client
from pandadoc_client.api import templates_api

API_KEY = ""
TEMPLATE_ID = ""

cfg = pandadoc_client.Configuration(
    host="https://api.pandadoc.com",
    api_key={"apiKey": f"API-Key {API_KEY}"},
)

client = pandadoc_client.ApiClient(cfg)
templates = templates_api.TemplatesApi(client)

template_detail = templates.details_template(id=TEMPLATE_ID)

Raises

pandadoc_client.exceptions.ApiTypeError: Invalid type for variable 'placeholder_name'.
Required value type is str and passed type was NoneType at 
['received_data']['roles'][0]['preassigned_person']['placeholder_name']

Example with GET

import requests

API_KEY = ""
TEMPLATE_ID = "" # same template as previous example

headers = {
    "Content-Type": "application/json",
    "Authorization": f"API-Key {API_KEY}"
}

url = "https://api.pandadoc.com/" + f"public/v1/templates/{TEMPLATE_ID}/details"
res = requests.get(url, headers=headers)
template_dict = res.json()

type(template_dict.get("roles")[0].get("preassigned_person").get("placeholder_name"))
>>> <class 'NoneType'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant