through API we are unable to add organisation and teams to the users

In the orchestration we are able to create the users manually and able to add organization and teams also.
But through API we are unable to add organization and teams to the users.
We tried 2 different API’s to add organization and teams. But every time either organization or teams we are able to add but not both.

  1. Through teams API we create the user and able to add the teams not the organization.
    API URL: /api/v2/teams/{team_id}/users/
  2. Through organization API we create the user and able to map the organization not the teams.
    API URL: /api/v2/organizations/{org_id}/users/

But the other API also we tried that is User API. But in that case we are able to create only user.
Is there any possible way to add both the teams and organization to that user through API?

Please help!
Thanks in advance,

When the UI is interacting with the API they have to make 2 different API calls to set the orgs and teams for a user. We are pretty positive you will have to do the same.

-The AWX Team

Hi AWX Project,

Thank you very much for your response. Can you please share the 2 API calls that are called by UI?

Thanks again,

Best wishes & Regards,
Ahmed

Apologies for the delay in response. Since AWX is an API first application the UI will make the same calls to the API that you will need to make. So the best way to do this is to open the developer console in the browser and make the request though the UI and just watch the traffic. The developer console will even show you the payloads it used when it made the requests to the API.

-The AWX Team