Chilkat Online Tools

PureBasic / Auth0 Management API / Search users by email

Back to Collection Items

IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"

Procedure ChilkatExample()

    ; This example assumes the Chilkat API to have been previously unlocked.
    ; See Global Unlock Sample for sample code.

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    queryParams.i = CkJsonObject::ckCreate()
    If queryParams.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckUpdateString(queryParams,"email","")

    ; Adds the "Authorization: Bearer {{auth0_token}}" header.
    CkHttp::setCkAuthToken(http, "{{auth0_token}}")

    resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://{{auth0_domain}}/api/v2/users-by-email",queryParams)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkJsonObject::ckDispose(queryParams)
        ProcedureReturn
    EndIf

    Debug Str(CkHttpResponse::ckStatusCode(resp))
    Debug CkHttpResponse::ckBodyStr(resp)
    CkHttpResponse::ckDispose(resp)



    CkHttp::ckDispose(http)
    CkJsonObject::ckDispose(queryParams)


    ProcedureReturn
EndProcedure

Curl Command

curl -G -d "email="
	-H "Authorization: Bearer {{auth0_token}}"
https://{{auth0_domain}}/api/v2/users-by-email

Postman Collection Item JSON

{
  "name": "Search users by email",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{auth0_token}}"
      }
    ],
    "url": {
      "raw": "https://{{auth0_domain}}/api/v2/users-by-email?email=",
      "protocol": "https",
      "host": [
        "{{auth0_domain}}"
      ],
      "path": [
        "api",
        "v2",
        "users-by-email"
      ],
      "query": [
        {
          "key": "email",
          "value": "",
          "description": "Email address to search for"
        }
      ]
    },
    "description": "If Auth0 is the identify provider (idP), the email address associated with a user is saved in lower case, regardless of how you initially provided it. For example, if you register a user as **JohnSmith@example.com**, Auth0 saves the user's email as **johnsmith@example.com**.\n\nIn cases where Auth0 is not the idP, the `email` is stored based on the rules of idP, so make sure the search is made using the correct capitalization.\n\nWhen using this endpoint, make sure that you are searching for users via email addresses using the correct case."
  },
  "response": [
  ]
}