(custom_fields)
- list - List Custom Fields
- create - Create Custom Field
- get - Get Custom Field
- update - Update Custom Field
- delete - Delete Custom Field
List custom fields.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.custom_fields.list()
if res is not None:
while True:
# handle items
res = res.next()
if res is None:
break
models.CustomFieldsListResponse
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Create a custom field.
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.custom_fields.create(request={
"slug": "<value>",
"name": "<value>",
"properties": {},
"type": polar_sdk.CustomFieldCreateNumberType.NUMBER,
})
if res is not None:
# handle response
pass
models.CustomField
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Get a custom field by ID.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.custom_fields.get(id="<value>")
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
The custom field ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CustomField
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update a custom field.
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.custom_fields.update(id="<value>", custom_field_update={
"type": polar_sdk.CustomFieldUpdateTextType.TEXT,
})
if res is not None:
# handle response
pass
models.CustomField
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Delete a custom field.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
s.custom_fields.delete(id="<value>")
# Use the SDK ...
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
The custom field ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |