Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on Expanded Attribute Behavior #17

Open
helgi-empower opened this issue Mar 8, 2023 · 0 comments
Open

Clarification on Expanded Attribute Behavior #17

helgi-empower opened this issue Mar 8, 2023 · 0 comments

Comments

@helgi-empower
Copy link

Hi there,

I have a question regarding the example in your README where you demonstrate how to use the expand parameter. Specifically, I noticed that the employments attribute returns a list of ids when it is not expanded. However, when expanded, it returns an Employment object. Is this expected behavior? And if so, how do I access all of the employments for a given employee?

from MergePythonSDK.shared import Configuration, ApiClient
from MergePythonSDK.hris.api.employees_api import EmployeesApi

configuration = Configuration()
configuration.access_token = "YOUR_API_KEY_HERE"
configuration.api_key_prefix['tokenAuth'] = 'Bearer'
configuration.api_key['accountTokenAuth'] = 'YOUR_X_ACCOUNT_TOKEN_HERE'
with ApiClient(configuration) as api_client:
    hris_employees_api_instance = EmployeesApi(api_client)
    try:
        # Test expands
        _id = "YOUR_EMPLOYEE_ID_HERE"
        employee_expands = hris_employees_api_instance.employees_retrieve(
          _id, expand="employments"
        )
        assert employee_expands.employments.employee == employee_expands.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant