# rxfoundry.clients.swifty_api.CodeApi
All URIs are relative to */api*
Method | HTTP request | Description
------------- | ------------- | -------------
[**get_code_types**](CodeApi.md#get_code_types) | **GET** /swifty/1/code_types | Get all code types
[**get_codes**](CodeApi.md#get_codes) | **GET** /swifty/1/codes | Get all codes for a typename
# **get_code_types**
> List[CodeType] get_code_types(page=page, results_per_page=results_per_page)
Get all code types
### Example
* Bearer (opaque) Authentication (opaque_token):
```python
import rxfoundry.clients.swifty_api
from rxfoundry.clients.swifty_api.models.code_type import CodeType
from rxfoundry.clients.swifty_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to /api
# See configuration.py for a list of all supported configuration parameters.
configuration = rxfoundry.clients.swifty_api.Configuration(
host = "/api"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization (opaque): opaque_token
configuration = rxfoundry.clients.swifty_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with rxfoundry.clients.swifty_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = rxfoundry.clients.swifty_api.CodeApi(api_client)
page = 1 # int | (optional) (default to 1)
results_per_page = 10 # int | (optional) (default to 10)
try:
# Get all code types
api_response = api_instance.get_code_types(page=page, results_per_page=results_per_page)
print("The response of CodeApi->get_code_types:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CodeApi->get_code_types: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page** | **int**| | [optional] [default to 1]
**results_per_page** | **int**| | [optional] [default to 10]
### Return type
[**List[CodeType]**](CodeType.md)
### Authorization
[opaque_token](../README.md#opaque_token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | A list of all code types | * X-Total-Count - Total number of prescriptions available
* X-Page - Current page number
* X-Per-Page - Number of prescriptions per page
* X-Total-Pages - Total number of pages available
|
**404** | No code types found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_codes**
> List[Code] get_codes(type_name, page=page, results_per_page=results_per_page)
Get all codes for a typename
### Example
* Bearer (opaque) Authentication (opaque_token):
```python
import rxfoundry.clients.swifty_api
from rxfoundry.clients.swifty_api.models.code import Code
from rxfoundry.clients.swifty_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to /api
# See configuration.py for a list of all supported configuration parameters.
configuration = rxfoundry.clients.swifty_api.Configuration(
host = "/api"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization (opaque): opaque_token
configuration = rxfoundry.clients.swifty_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with rxfoundry.clients.swifty_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = rxfoundry.clients.swifty_api.CodeApi(api_client)
type_name = 'type_name_example' # str | Filter codes by type name
page = 1 # int | (optional) (default to 1)
results_per_page = 10 # int | (optional) (default to 10)
try:
# Get all codes for a typename
api_response = api_instance.get_codes(type_name, page=page, results_per_page=results_per_page)
print("The response of CodeApi->get_codes:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CodeApi->get_codes: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**type_name** | **str**| Filter codes by type name |
**page** | **int**| | [optional] [default to 1]
**results_per_page** | **int**| | [optional] [default to 10]
### Return type
[**List[Code]**](Code.md)
### Authorization
[opaque_token](../README.md#opaque_token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | A list of all codes | * X-Total-Count - Total number of prescriptions available
* X-Page - Current page number
* X-Per-Page - Number of prescriptions per page
* X-Total-Pages - Total number of pages available
|
**404** | No codes found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)