API Reference
strapi_client
StrapiClientAsync
Bases: StrapiClientBase
Async REST API client for Strapi.
Source code in src/strapi_client/strapi_client_async.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
authorize
async
authorize(identifier, password)
Get auth token using identifier and password.
Source code in src/strapi_client/strapi_client_async.py
45 46 47 48 49 50 51 52 53 54 | |
get_single_document
async
get_single_document(single_api_id)
Get document of single type.
Source code in src/strapi_client/strapi_client_async.py
56 57 58 59 | |
get_document
async
get_document(
plural_api_id,
document_id,
populate=None,
fields=None,
locale=None,
)
Get document by document id.
Source code in src/strapi_client/strapi_client_async.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
get_documents
async
get_documents(
plural_api_id,
sort=None,
filters=None,
populate=None,
fields=None,
publication_state=None,
locale=None,
start=None,
page=None,
batch_size=25,
with_count=True,
)
Get list of documents. By default, operates in batch mode to get all documents automatically.
Source code in src/strapi_client/strapi_client_async.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
create_or_update_single_document
async
create_or_update_single_document(single_api_id, data)
Create or update single type document.
Source code in src/strapi_client/strapi_client_async.py
120 121 122 123 124 125 | |
create_document
async
create_document(plural_api_id, data)
Create new document.
Source code in src/strapi_client/strapi_client_async.py
127 128 129 130 131 132 133 | |
update_document
async
update_document(plural_api_id, document_id, data)
Update document fields.
Source code in src/strapi_client/strapi_client_async.py
135 136 137 138 139 140 141 142 143 | |
delete_single_document
async
delete_single_document(single_api_id)
Delete single type document.
Source code in src/strapi_client/strapi_client_async.py
145 146 147 | |
delete_document
async
delete_document(plural_api_id, document_id)
Delete document by document id.
Source code in src/strapi_client/strapi_client_async.py
149 150 151 | |
send_get_request
async
send_get_request(route, params=None, use_auth=True)
Send GET request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
send_put_request
async
send_put_request(
route, body=None, params=None, use_auth=True
)
Send PUT request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
166 167 168 169 170 171 172 173 174 175 176 177 178 | |
send_post_request
async
send_post_request(
route,
json=None,
params=None,
data=None,
files=None,
use_auth=True,
)
Send POST request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
send_delete_request
async
send_delete_request(route, use_auth=True)
Send DELETE request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
201 202 203 204 205 206 207 | |
upload_files
async
upload_files(
files,
content_type_id=None,
document_id=None,
field=None,
)
Upload a list of files.
Source code in src/strapi_client/strapi_client_async.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
upload_file
async
upload_file(
file, content_type_id=None, document_id=None, field=None
)
Upload a list of files.
Source code in src/strapi_client/strapi_client_async.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
get_uploaded_files
async
get_uploaded_files(filters=None)
Get uploaded files.
Source code in src/strapi_client/strapi_client_async.py
249 250 251 252 253 | |
check_health
async
check_health()
Check if Strapi API is available.
Source code in src/strapi_client/strapi_client_async.py
255 256 257 258 259 260 261 262 263 | |
StrapiClient
Bases: StrapiClientBase
REST API client for Strapi.
Source code in src/strapi_client/strapi_client.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
authorize
authorize(identifier, password)
Get auth token using identifier and password.
Source code in src/strapi_client/strapi_client.py
45 46 47 48 49 50 51 52 53 54 | |
get_single_document
get_single_document(single_api_id)
Get document of single type.
Source code in src/strapi_client/strapi_client.py
56 57 58 59 | |
get_document
get_document(
plural_api_id,
document_id,
populate=None,
fields=None,
locale=None,
)
Get document by document id.
Source code in src/strapi_client/strapi_client.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
get_documents
get_documents(
plural_api_id,
sort=None,
filters=None,
populate=None,
fields=None,
publication_state=None,
locale=None,
start=None,
page=None,
batch_size=25,
with_count=True,
)
Get list of documents. By default, operates in batch mode to get all documents automatically.
Source code in src/strapi_client/strapi_client.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
create_or_update_single_document
create_or_update_single_document(single_api_id, data)
Create or update single type document.
Source code in src/strapi_client/strapi_client.py
120 121 122 123 124 125 | |
create_document
create_document(plural_api_id, data)
Create new document.
Source code in src/strapi_client/strapi_client.py
127 128 129 130 131 132 133 | |
update_document
update_document(plural_api_id, document_id, data)
Update document fields.
Source code in src/strapi_client/strapi_client.py
135 136 137 138 139 140 141 142 143 | |
delete_single_document
delete_single_document(single_api_id)
Delete single type document.
Source code in src/strapi_client/strapi_client.py
145 146 147 | |
delete_document
delete_document(plural_api_id, document_id)
Delete document by document id.
Source code in src/strapi_client/strapi_client.py
149 150 151 | |
send_get_request
send_get_request(route, params=None, use_auth=True)
Send GET request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
send_put_request
send_put_request(
route, body=None, params=None, use_auth=True
)
Send PUT request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
166 167 168 169 170 171 172 173 174 175 176 177 178 | |
send_post_request
send_post_request(
route,
json=None,
params=None,
data=None,
files=None,
use_auth=True,
)
Send POST request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
send_delete_request
send_delete_request(route, use_auth=True)
Send DELETE request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
201 202 203 204 205 | |
upload_files
upload_files(
files,
content_type_id=None,
document_id=None,
field=None,
)
Upload a list of files.
Source code in src/strapi_client/strapi_client.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
upload_file
upload_file(
file, content_type_id=None, document_id=None, field=None
)
Upload a list of files.
Source code in src/strapi_client/strapi_client.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
get_uploaded_files
get_uploaded_files(filters=None)
Get uploaded files.
Source code in src/strapi_client/strapi_client.py
247 248 249 250 251 | |
check_health
check_health()
Check if Strapi API is available.
Source code in src/strapi_client/strapi_client.py
253 254 255 256 257 258 259 260 261 | |
BaseDocument
pydantic-model
Bases: BasePopulatable
Strapi document with standard fields.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/base_document.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
BaseComponent
pydantic-model
Bases: BasePopulatable
Strapi component.
Source code in src/strapi_client/models/base_component.py
4 5 | |
MediaImageDocument
pydantic-model
Bases: BaseDocument
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime) -
name(str) -
alternative_text(str | None) -
caption(str | None) -
width(int | None) -
height(int | None) -
formats(MediaImageFormats | None) -
hash(str) -
ext(str) -
mime(str) -
size(float) -
url(str) -
preview_url(str | None) -
provider(str) -
provider_metadata(dict[str, Any] | None)
Source code in src/strapi_client/models/media_image_document.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
size
pydantic-field
size
Size in kilobytes
SmartDocument
pydantic-model
Bases: BaseDocument
Fully automated ORM class for Strapi documents.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/smart_document.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
get_document
async
classmethod
get_document(client, document_id)
Get document by document id.
Source code in src/strapi_client/models/smart_document.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
get_documents
async
classmethod
get_documents(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
get_documents_with_meta
async
classmethod
get_documents_with_meta(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
get_first_document
async
classmethod
get_first_document(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
)
First documents if available.
Source code in src/strapi_client/models/smart_document.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
create_document
async
classmethod
create_document(client, data)
Create a new document.
Source code in src/strapi_client/models/smart_document.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
model_dump_data
model_dump_data(
exclude_managed_fields=False, json_mode=False
)
Create a dictionary representation of the document.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/strapi_client/models/smart_document.py
166 167 168 169 170 171 172 173 174 175 176 177 178 | |
update_document
async
update_document(
client,
data,
lazy_mode=False,
do_not_compare_fields=None,
)
Update existing document.
Source code in src/strapi_client/models/smart_document.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
lazy_update_document
async
lazy_update_document(
client, data, do_not_compare_fields=None
)
Lazy update existing document fields without record synchronization.
Source code in src/strapi_client/models/smart_document.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
update_relations
async
update_relations(
client,
field,
relations=None,
connect=None,
disconnect=None,
)
Update field relations.
Source code in src/strapi_client/models/smart_document.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
refresh_document
async
refresh_document(client)
Refresh the document with the latest data from Strapi.
Source code in src/strapi_client/models/smart_document.py
258 259 260 261 262 263 264 265 266 267 268 269 | |
delete_document
async
delete_document(client)
Delete the document.
Source code in src/strapi_client/models/smart_document.py
271 272 273 274 275 276 | |
upload_file
async
upload_file(client, file, field)
Upload a file to the document's field.
Source code in src/strapi_client/models/smart_document.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
SingleSmartDocument
pydantic-model
Bases: BaseDocument
Fully automated ORM class for single Strapi document.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/single_smart_document.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
get_document
async
classmethod
get_document(client)
Get single document by single api id.
Source code in src/strapi_client/models/single_smart_document.py
20 21 22 23 24 25 26 27 | |
ActiveDocument
pydantic-model
Bases: BaseModel
Experimental ORM class for Strapi document.
Fields:
-
id(int | None) -
document_id(str | None) -
created_at(datetime | None) -
updated_at(datetime | None) -
published_at(datetime | None)
Source code in src/strapi_client/models/active_document.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
get_document
async
classmethod
get_document(client, document_id, populate_all=True)
Get document by document id.
Source code in src/strapi_client/models/active_document.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
get_documents
async
classmethod
get_documents(
client,
populate_all=True,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=0,
page=None,
limit=25,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/active_document.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
create_document
async
create_document(client)
Create new document from object.
Source code in src/strapi_client/models/active_document.py
92 93 94 95 | |
update_document
async
update_document(client)
Update document fields from object.
Source code in src/strapi_client/models/active_document.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
delete_document
async
delete_document(client)
Delete document attached to object.
Source code in src/strapi_client/models/active_document.py
114 115 116 117 118 | |
refresh
async
refresh(client, populate_all=True)
Refresh object with latest data from Strapi including relations.
Source code in src/strapi_client/models/active_document.py
127 128 129 130 131 132 133 134 135 136 | |
upsert_document
async
upsert_document(client)
Create document or update fields.
Source code in src/strapi_client/models/active_document.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |