Skip to content

Latest commit

 

History

History
743 lines (583 loc) · 56.1 KB

File metadata and controls

743 lines (583 loc) · 56.1 KB

fds.analyticsapi.engines.SPARCalculationsApi

All URIs are relative to https://api.factset.com

Method HTTP request Description
cancel_calculation_by_id DELETE /analytics/engines/spar/v3/calculations/{id} Cancel SPAR calculation
get_all_calculations GET /analytics/engines/spar/v3/calculations Get all calculations
get_calculation_parameters GET /analytics/engines/spar/v3/calculations/{id} Get SPAR calculation parameters by id
get_calculation_status_by_id GET /analytics/engines/spar/v3/calculations/{id}/status Get SPAR calculation status by id
get_calculation_unit_result_by_id GET /analytics/engines/spar/v3/calculations/{id}/units/{unitId}/result Get SPAR calculation result by id
post_and_calculate POST /analytics/engines/spar/v3/calculations Create and Run SPAR calculation
put_and_calculate PUT /analytics/engines/spar/v3/calculations/{id} Create or Update SPAR calculation and run it.

cancel_calculation_by_id

cancel_calculation_by_id(id)

Cancel SPAR calculation

This is the endpoint to cancel a previously submitted calculation.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    id = "id_example" # str | from url, provided from the location header in the Create and Run SPAR calculation endpoint

    # example passing only required values which don't have defaults set
    try:
        # Cancel SPAR calculation
        api_instance.cancel_calculation_by_id(id)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->cancel_calculation_by_id: %s\n" % e)

Parameters

Name Type Description Notes
id str from url, provided from the location header in the Create and Run SPAR calculation endpoint

Return type

  • A tuple with response data, HTTP status code and response headers.
  • Response datatype: None (empty response body)

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
204 Expected response, calculation was canceled successfully. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid identifier provided. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 There was no request for the calculation identifier provided, or the request was already canceled for the provided identifier. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_all_calculations

CalculationsSummaryRoot get_all_calculations()

Get all calculations

This endpoints returns all calculation requests.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.calculations_summary_root import CalculationsSummaryRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    page_number = 1 # int |  (optional) if omitted the server will use the default value of 1

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get all calculations
        api_response = api_instance.get_all_calculations(page_number=page_number)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->get_all_calculations: %s\n" % e)

Parameters

Name Type Description Notes
page_number int [optional] if omitted the server will use the default value of 1

Return type

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of calculation requests. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid page number. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 No calculation found. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
406 Unsupported Accept header. Header needs to be set to application/json. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
429 Rate limit reached. Wait till the time specified in Retry-After header value to make further requests. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* Retry-After - Time to wait in seconds before making a new request as the rate limit has reached.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_calculation_parameters

SPARCalculationParametersRoot get_calculation_parameters(id)

Get SPAR calculation parameters by id

This is the endpoint that returns the calculation parameters passed for a calculation.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.spar_calculation_parameters_root import SPARCalculationParametersRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    id = "id_example" # str | from url, provided from the location header in the Create and Run SPAR calculation endpoint

    # example passing only required values which don't have defaults set
    try:
        # Get SPAR calculation parameters by id
        api_response = api_instance.get_calculation_parameters(id)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->get_calculation_parameters: %s\n" % e)

Parameters

Name Type Description Notes
id str from url, provided from the location header in the Create and Run SPAR calculation endpoint

Return type

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Expected response, returns the SPAR calculation parameters. * Content-Encoding - Standard HTTP header. Header value based on Accept-Encoding Request header.
* Content-Type - Standard HTTP header.
* Transfer-Encoding - Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid identifier provided. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 Calculation id not found * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_calculation_status_by_id

CalculationStatusRoot get_calculation_status_by_id(id)

Get SPAR calculation status by id

This is the endpoint to check on the progress of a previously requested calculation. If the calculation has finished computing, the location header will point to the result url.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.calculation_status_root import CalculationStatusRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    id = "id_example" # str | from url, provided from the location header in the Create and Run SPAR calculation endpoint

    # example passing only required values which don't have defaults set
    try:
        # Get SPAR calculation status by id
        api_response = api_instance.get_calculation_status_by_id(id)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->get_calculation_status_by_id: %s\n" % e)

Parameters

Name Type Description Notes
id str from url, provided from the location header in the Create and Run SPAR calculation endpoint

Return type

  • A tuple with response data, HTTP status code and response headers.
  • Response datatype: CalculationStatusRoot

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Expected response once calculation is completed. * Content-Encoding - Standard HTTP header. Header value based on Accept-Encoding Request header.
* Content-Type - Standard HTTP header.
* Transfer-Encoding - Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
202 Expected response returned if the calculation is not yet completed. * X-FactSet-Api-PickUp-Progress - FactSet's progress header.
* Cache-Control - Standard HTTP header. Header will specify max-age in seconds. Polling can be adjusted based on the max-age value.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid identifier provided. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 Calculation was already returned, provided id was not a requested calculation, or the calculation was cancelled * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_calculation_unit_result_by_id

ObjectRoot get_calculation_unit_result_by_id(id, unit_id)

Get SPAR calculation result by id

This is the endpoint to get the result of a previously requested calculation. If the calculation has finished computing, the body of the response will contain the requested document in JSON.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    id = "id_example" # str | from url, provided from the location header in the Get SPAR calculation status by id endpoint
    unit_id = "unitId_example" # str | from url, provided from the location header in the Get SPAR calculation status by id endpoint

    # example passing only required values which don't have defaults set
    try:
        # Get SPAR calculation result by id
        api_response = api_instance.get_calculation_unit_result_by_id(id, unit_id)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->get_calculation_unit_result_by_id: %s\n" % e)

Parameters

Name Type Description Notes
id str from url, provided from the location header in the Get SPAR calculation status by id endpoint
unit_id str from url, provided from the location header in the Get SPAR calculation status by id endpoint

Return type

  • A tuple with response data, HTTP status code and response headers.
  • Response datatype: ObjectRoot

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/x-protobuf

HTTP response details

Status code Description Response headers
200 Expected response once calculation is completed, returns JSON in the format specified in the Calculation parameters. * Content-Encoding - Standard HTTP header. Header value based on Accept-Encoding Request header.
* Content-Type - Standard HTTP header.
* Transfer-Encoding - Standard HTTP header. Header value will be set to Chunked if Accept-Encoding header is specified.
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid identifier provided. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 Calculation was already returned, provided id was not a requested calculation, or the calculation was cancelled * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

post_and_calculate

CalculationStatusRoot post_and_calculate()

Create and Run SPAR calculation

This endpoint runs the SPAR calculation specified in the POST body parameters. It can take one or more units as input. Remarks: * Any settings in POST body will act as a one-time override over the settings saved in the SPAR template.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.calculation_status_root import CalculationStatusRoot
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.spar_calculation_parameters_root import SPARCalculationParametersRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    x_fact_set_api_long_running_deadline = 10 # int | Long running deadline in seconds when only one unit is passed in the POST body. Example value is set to 10s. Please update it as per requirement before triggering a calculation. (optional)
    cache_control = "Cache-Control_example" # str | Standard HTTP header.  Accepts max-stale. (optional)
    spar_calculation_parameters_root = SPARCalculationParametersRoot(
        data={
            "key": SPARCalculationParameters(
                componentid="componentid_example",
                accounts=[
                    SPARIdentifier(
                        id="id_example",
                        returntype="returntype_example",
                        prefix="prefix_example",
                    ),
                ],
                benchmark=SPARIdentifier(
                    id="id_example",
                    returntype="returntype_example",
                    prefix="prefix_example",
                ),
                dates=SPARDateParameters(
                    startdate="startdate_example",
                    enddate="enddate_example",
                    frequency="frequency_example",
                ),
                currencyisocode="currencyisocode_example",
            ),
        },
        meta=CalculationMeta(
            contentorganization="SimplifiedRow",
            stach_content_organization="SimplifiedRow",
            contenttype="Json",
            format="JsonStach",
        ),
    ) # SPARCalculationParametersRoot | Calculation Parameters (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Create and Run SPAR calculation
        api_response = api_instance.post_and_calculate(x_fact_set_api_long_running_deadline=x_fact_set_api_long_running_deadline, cache_control=cache_control, spar_calculation_parameters_root=spar_calculation_parameters_root)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->post_and_calculate: %s\n" % e)

Parameters

Name Type Description Notes
x_fact_set_api_long_running_deadline int Long running deadline in seconds when only one unit is passed in the POST body. Example value is set to 10s. Please update it as per requirement before triggering a calculation. [optional]
cache_control str Standard HTTP header. Accepts max-stale. [optional]
spar_calculation_parameters_root SPARCalculationParametersRoot Calculation Parameters [optional]

Return type

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/x-protobuf

HTTP response details

Status code Description Response headers
202 Expected response, contains the poll URL in the Location header. * Location - URL to poll for the resulting calculation
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
200 Expected response, if the calculation has one unit and is completed with an error. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
201 Expected response if the calculation has one unit and is completed in a short span, returns JSON in the format specified in the Calculation parameters. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid calculation parameters. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 One or more calculation settings were unavailable. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
415 Missing/Invalid Content-Type header. Header needs to be set to application/json. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
429 Rate limit reached. Cancel older requests using Cancel Calculation endpoint or wait for older requests to finish/expire. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
* Retry-After - Time to wait in seconds before making a new request as the rate limit has reached.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

put_and_calculate

CalculationStatusRoot put_and_calculate(id)

Create or Update SPAR calculation and run it.

This endpoint updates and run the SPAR calculation specified in the PUT body parameters. This also allows creating new SPAR calculations with custom ids. It can take one or more units as input. Remarks: * Any settings in PUT body will act as a one-time override over the settings saved in the SPAR template.

Example

  • Basic Authentication (Basic):
  • Bearer Authentication (Bearer):
import time
import fds.analyticsapi.engines
from fds.analyticsapi.engines.api import spar_calculations_api
from fds.analyticsapi.engines.model.calculation_status_root import CalculationStatusRoot
from fds.analyticsapi.engines.model.object_root import ObjectRoot
from fds.analyticsapi.engines.model.spar_calculation_parameters_root import SPARCalculationParametersRoot
from fds.analyticsapi.engines.model.client_error_response import ClientErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.factset.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fds.analyticsapi.engines.Configuration(
    host = "https://api.factset.com"
)

# 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 HTTP basic authorization: Basic
configuration = fds.analyticsapi.engines.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)

# Configure Bearer authorization: Bearer
configuration = fds.analyticsapi.engines.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with fds.analyticsapi.engines.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = spar_calculations_api.SPARCalculationsApi(api_client)
    id = "id_example" # str | from url, provided from the location header in the Create and Run SPAR calculation endpoint
    x_fact_set_api_long_running_deadline = 10 # int | Long running deadline in seconds when only one unit is passed in the PUT body. Example value is set to 10s. Please update it as per requirement before triggering a calculation. (optional)
    cache_control = "Cache-Control_example" # str | Standard HTTP header.  Accepts max-stale. (optional)
    spar_calculation_parameters_root = SPARCalculationParametersRoot(
        data={
            "key": SPARCalculationParameters(
                componentid="componentid_example",
                accounts=[
                    SPARIdentifier(
                        id="id_example",
                        returntype="returntype_example",
                        prefix="prefix_example",
                    ),
                ],
                benchmark=SPARIdentifier(
                    id="id_example",
                    returntype="returntype_example",
                    prefix="prefix_example",
                ),
                dates=SPARDateParameters(
                    startdate="startdate_example",
                    enddate="enddate_example",
                    frequency="frequency_example",
                ),
                currencyisocode="currencyisocode_example",
            ),
        },
        meta=CalculationMeta(
            contentorganization="SimplifiedRow",
            stach_content_organization="SimplifiedRow",
            contenttype="Json",
            format="JsonStach",
        ),
    ) # SPARCalculationParametersRoot | Calculation Parameters (optional)

    # example passing only required values which don't have defaults set
    try:
        # Create or Update SPAR calculation and run it.
        api_response = api_instance.put_and_calculate(id)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->put_and_calculate: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Create or Update SPAR calculation and run it.
        api_response = api_instance.put_and_calculate(id, x_fact_set_api_long_running_deadline=x_fact_set_api_long_running_deadline, cache_control=cache_control, spar_calculation_parameters_root=spar_calculation_parameters_root)
        pprint(api_response)
    except fds.analyticsapi.engines.ApiException as e:
        print("Exception when calling SPARCalculationsApi->put_and_calculate: %s\n" % e)

Parameters

Name Type Description Notes
id str from url, provided from the location header in the Create and Run SPAR calculation endpoint
x_fact_set_api_long_running_deadline int Long running deadline in seconds when only one unit is passed in the PUT body. Example value is set to 10s. Please update it as per requirement before triggering a calculation. [optional]
cache_control str Standard HTTP header. Accepts max-stale. [optional]
spar_calculation_parameters_root SPARCalculationParametersRoot Calculation Parameters [optional]

Return type

Authorization

Basic, Bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/x-protobuf

HTTP response details

Status code Description Response headers
202 Expected response, contains the poll URL in the Location header. * Location - URL to poll for the resulting calculation
* X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
200 Expected response, if the calculation has one unit and is completed with an error. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
201 Expected response if the calculation has one unit and is completed in a short span, returns JSON in the format specified in the Calculation parameters. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
400 Invalid Calculation Parameters. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
404 One or more calculation settings were unavailable. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
409 Duplicate calculation exists with same parameters. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
401 Missing or invalid authentication. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
403 User is forbidden with current credentials * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
415 Missing/Invalid Content-Type header. Header needs to be set to application/json. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
429 Rate limit reached. Cancel older requests using Cancel Calculation endpoint or wait for older requests to finish/expire. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
* X-FactSet-Api-RateLimit-Limit - Number of allowed requests for the time window.
* X-FactSet-Api-RateLimit-Remaining - Number of requests left for the time window.
* X-FactSet-Api-RateLimit-Reset - Number of seconds remaining till rate limit resets.
* Retry-After - Time to wait in seconds before making a new request as the rate limit has reached.
500 Server error. Log the X-DataDirect-Request-Key header to assist in troubleshooting. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.
503 Request timed out. Retry the request in sometime. * X-DataDirect-Request-Key - FactSet's request key header.
* X-FactSet-Api-Request-Key - Key to uniquely identify an Analytics API request. Only available after successful authentication.

[Back to top] [Back to API list] [Back to Model list] [Back to README]