Skip to main content

Strapi API SDK

Interact with Strapi functionalities within your python application, includes the ability to perform create, read, update, and delete (CRUD) operations on existing APIs endpoints and provides an Authenticator class ready to create new users, API Tokens and etc.

Instalation

pip install strapi-api-sdk

Usage Example

You can use strapi-api-sdk to:

  • Create, update and delete registers on all APIs that your Strapi application provides.
  • Create a user inside Strapi with a specific or generic role (public, authenticated, etc).
  • Create an API Token to a specific user (using the JWT auth from Strapi's core).

Code example

from strapi_api_sdk.sdk import (
    StrapiAuthenticator,
    StrapiUser,
    StrapiClient
)


BASE_URL = "https://strapi.mybaseurl.com.br"
TOKEN = "my-token-as-string"

# Instantiate clients.
auth = StrapiAuthenticator(base_url=BASE_URL, api_token=TOKEN)
user = StrapiUser(base_url=BASE_URL, auth=auth)
client = StrapiClient(base_url=BASE_URL, auth=auth, request_timeout=800)

# Create a new user
# NOTE: In the absence of password parameter, the class creates a random URL-safe text string, in Base64 encoding and use it as the user password.
new_user = user.register_user(
    username="creation-tester2",
    email="creation2@tester.com.br",
    role_type="authenticated",
)

# Create an API token for this user
new_user_token = auth.create_token(
    identifier=new_user["username"], 
    password=new_user["password"]
)

# Retrieve some data.
api_data = client.get_entries(plural_api_id="api-ids", batch_size=100)
one_api_data = client.get_entry(plural_api_id="api-ids", document_id=1, populate=["*"])

# Create entry.
api_data_to_create_dict = {
    "foo": "bar",
    "num": 35
}
create_api_data = client.create_entry(plural_api_id="some-apis", data=api_data_to_create_dict)

Happy Coding! :)

Metadata

Release files for strapi-api-sdk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strapi-api-sdk 0.2.1
File Size Uploaded Provenance
strapi_api_sdk-0.2.1.tar.gz 6.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for strapi-api-sdk 0.2.1
File Interpreter ABI Platform
strapi_api_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / strapi_api_sdk-0.2.1.tar.gz

Download URL strapi_api_sdk-0.2.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7569b2ebd9366b19587cc1ba0715b7793c43d437f005e38d2f5604e158fc402f
BLAKE2b-256 checksum
How to use checksums
cff0ef086051d5567e0bb9a7bb507434d1a663a248aa643ff635a1d8359bf02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / strapi_api_sdk-0.2.1-py3-none-any.whl

Download URL strapi_api_sdk-0.2.1-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cb3abab17a72039ecd4379a07ccac31669a56dc3a74d80479e7939ac25b47a2
BLAKE2b-256 checksum
How to use checksums
e55b399226b1f2e5bf03c90110d7c5117cf741de7a3bd8ca5250c1b1be965c5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for strapi-api-sdk 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page