Keys endpoint¶
Fetch all keys¶
-
keys
(project_id[, params=None])¶ Parameters: - project_id (str) – ID of the project
- params (dict) – Request parameters
Returns: Collection of keys
Please note that this endpoint should not be treated as a content delivery network for your language files. It means that you should not perform a new request to this endpoint with every website/app visitor. Instead, fetch this endpoint from time to time, store the result locally and serve your visitors with static files/your database content. Alternatively, you may use our Amazon S3/Google CouldStorage integrations in automatically upload your language files to a bucket of your choice.
Example:
client.keys('123.abc', {
"page": 2,
"limit": 3,
"disable_references": "1",
"filter_archived": "exclude"
})
Create keys¶
-
create_keys
(project_id, params)¶ Parameters: - project_id (str) – ID of the project
- params (list or dict) – Keys parameters
Returns: Keys collection
Example:
client.create_keys('123.abc', [
{
"key_name": "python_1",
"platforms": ["ios", "android"],
"description": "Created by Python"
},
{
"key_name": "python_2",
"platforms": ["web"],
"translations": [
{
"language_iso": "en",
"translation": "Hi from Python"
}
]
}
])
Fetch a key¶
-
key
(project_id, key_id[, params=None])¶ Parameters: - project_id (str) – ID of the project
- key_id – ID of the key to fetch
- params (dict) – Request parameters
Returns: Key model
Example:
key = client.key('123.abc', 3456, {"disable_references": "1"})
key.key_id # => 3456
key.key_name['ios'] # => "manual_setup"
Update a key¶
-
update_key
(project_id, key_id[, params = None])¶ Parameters: - project_id (str) – ID of the project
- key_id – ID of the key to update
- params (dict) – Request parameters
Returns: Key model
Example:
key = client.update_key('123.abc', 3456, {
"description": "Updated by Python",
"tags": ["python"]
})
key.description # => "Updated by Python"
Bulk key update¶
-
update_keys
(project_id, params)¶ Parameters: - project_id (str) – ID of the project
- params (dict) – Key parameters
Returns: Key collection
Example:
keys = client.update_keys('123.abc', [
{
"key_id": 48855757,
"description": "Bulk updated",
"tags": ["bulk-python"]
},
{
"key_id": 48855758,
"translations": [
{
"language_iso": "en",
"translation": "Updated Python translation"
}
]
}
])
keys.items[0].description # => "Bulk updated"