All URIs are relative to https://api.cloudsmith.io
| Method | HTTP request | Description |
|---|---|---|
| user_self | GET /user/self/ | Provide a brief for the current user (if any). |
| user_token_create | POST /user/token/ | Create or retrieve API token for a user. |
| user_tokens_create | POST /user/tokens/ | Create an API key for the user that is currently authenticated. |
| user_tokens_list | GET /user/tokens/ | Retrieve the API key assigned to the user that is currently authenticated. |
| user_tokens_refresh | PUT /user/tokens/{slug_perm}/refresh/ | Refresh the specified API key for the user that is currently authenticated. |
UserBrief user_self()
Provide a brief for the current user (if any).
Provide a brief for the current user (if any).
from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: apikey
configuration = cloudsmith_api.Configuration()
configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Api-Key'] = 'Bearer'
# Configure HTTP basic authorization: basic
configuration = cloudsmith_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cloudsmith_api.UserApi(cloudsmith_api.ApiClient(configuration))
try:
# Provide a brief for the current user (if any).
api_response = api_instance.user_self()
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->user_self: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthToken user_token_create(data=data)
Create or retrieve API token for a user.
Handles both: - Users authenticating with basic credentials to get a token - Two-factor authentication flow
from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cloudsmith_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cloudsmith_api.UserApi(cloudsmith_api.ApiClient(configuration))
data = cloudsmith_api.UserAuthTokenRequest() # UserAuthTokenRequest | (optional)
try:
# Create or retrieve API token for a user.
api_response = api_instance.user_token_create(data=data)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->user_token_create: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| data | UserAuthTokenRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthenticationToken user_tokens_create()
Create an API key for the user that is currently authenticated.
Create an API key for the user that is currently authenticated.
from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: apikey
configuration = cloudsmith_api.Configuration()
configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Api-Key'] = 'Bearer'
# Configure HTTP basic authorization: basic
configuration = cloudsmith_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cloudsmith_api.UserApi(cloudsmith_api.ApiClient(configuration))
try:
# Create an API key for the user that is currently authenticated.
api_response = api_instance.user_tokens_create()
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->user_tokens_create: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2002 user_tokens_list(page=page, page_size=page_size)
Retrieve the API key assigned to the user that is currently authenticated.
Retrieve the API key assigned to the user that is currently authenticated.
from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: apikey
configuration = cloudsmith_api.Configuration()
configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Api-Key'] = 'Bearer'
# Configure HTTP basic authorization: basic
configuration = cloudsmith_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cloudsmith_api.UserApi(cloudsmith_api.ApiClient(configuration))
page = 56 # int | A page number within the paginated result set. (optional)
page_size = 56 # int | Number of results to return per page. (optional)
try:
# Retrieve the API key assigned to the user that is currently authenticated.
api_response = api_instance.user_tokens_list(page=page, page_size=page_size)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->user_tokens_list: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| page | int | A page number within the paginated result set. | [optional] |
| page_size | int | Number of results to return per page. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthenticationToken user_tokens_refresh(slug_perm)
Refresh the specified API key for the user that is currently authenticated.
Refresh the specified API key for the user that is currently authenticated.
from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: apikey
configuration = cloudsmith_api.Configuration()
configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Api-Key'] = 'Bearer'
# Configure HTTP basic authorization: basic
configuration = cloudsmith_api.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cloudsmith_api.UserApi(cloudsmith_api.ApiClient(configuration))
slug_perm = 'slug_perm_example' # str |
try:
# Refresh the specified API key for the user that is currently authenticated.
api_response = api_instance.user_tokens_refresh(slug_perm)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->user_tokens_refresh: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| slug_perm | str |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]