New Search API for SonarCloud

Hi.

hello.
I have received an email informing us about some changes in the search api for users outside and inside the organization.
This affects us directly and we need to make changes in our application in order to use the new api, as we are using the (api/organizations/search_members) with the attribute “selected”.

However, the link sent in the email with the new documentation is not available. Can you please check the integrity of the link and give us the correct one please?

Line sent: https://sonarcloud.io/web_api/new_api/users?deprecated=false

There is no any information in this page.

Thanks so much.

I think that means we just sent out an e-mail with a link only accessible to internal users :smiley:

I am going to follow-up on this. Hold tight.

For now, this is what you’re missing

1 Like

Hi @juanfer007

Thank you for raising this issue, we have a fix in process to resolve the issue you have raised. For now I will share the details with you here so you can proceed. As you can see the new endpoint requires a specific email address to be passed to lookup information of the requested user so that they can be added to an organization.

endpoint:

https://api.sonarcloud.io/users/users

Parameters:

email: string
required

Example Value
john.doe@example.com

Response Example:

{
    "users": [
        {
            "id": "5af4ecd2-4s0f-44dc-84c2-1819d4927e3c",
            "login": "JohnDoe@github",
            "name": "John Doe",
            "email": "john.doe@example.com",
            "externalProvider": "github",
            "avatar": "7e9adc0038a88cbe2ee216fdf79d3e4e"
        }
    ],
    "page": {
        "pageIndex": 1,
        "pageSize": 50,
        "total": 1
    }
}
1 Like

Is there some particular reason that this new endpoint is not available in url prefix ‘https://sonarcloud.io/api/’ like rest of the endpoints, but only in ‘https://api.sonarcloud.io/’?

+1 …
We have an automation that has been running for a long time that adds new users to our org.
First we retrieve the user:
https://sonarcloud.io/api/users/search?q=email@address.com

Then we add them by id to our org.

Sometime in the past couple months (last successful run was in April) this started failing to find new users.

However I can find the user at
https://api.sonarcloud.io/users/users?email=email@address.com

Is it intentional that users arent available at both endpoints?
Is it expected that we move to the new one only?

Hello William,

We deprecated the search for users outside the organization in the endpoint api/users/search.

We created a new endpoint instead: api/users/users. This endpoint works only with an exact email search.

Please update your automation with the second endpoint.

Thank you.