A module representing jobs on Auth0.
Jobs are Auth0's asynchronous operations: bulk user import and export, and
verification emails. Import and export both return a job immediately and do the
work in the background, so the pattern is to start one, poll get/1 until its
status is "completed", then check errors/1.
Summary
Functions
Gets the errors from a completed import job.
Gets a job's status.
Sends a verification email for the given user. user_id is required.
Starts a job exporting users from a connection.
Starts a job importing users into a connection.
Functions
Gets the errors from a completed import job.
Auth0 answers 204 when there were none, so a clean import returns a bare :ok
and a partial one returns {:ok, errors}. Match both:
case Auth0Client.Management.Job.errors(job_id) do
:ok -> :no_errors
{:ok, errors} -> handle(errors)
end
Gets a job's status.
Poll this after starting an import or export; status moves through "pending"
to "completed", and an export adds a location to download from.
iex> Auth0Client.Management.Job.get("job_abc123")
Sends a verification email for the given user. user_id is required.
iex> Auth0Client.Management.Job.send_verification_email(%{user_id: "auth0|123", client_id: "a_client_id"})
Starts a job exporting users from a connection.
Returns immediately; poll get/1 until the job carries a location to download.
iex> Auth0Client.Management.Job.users_exports(%{connection_id: "con_1", format: "json"})
iex> Auth0Client.Management.Job.users_exports(%{connection_id: "con_1", fields: [%{name: "email"}], limit: 1000})
Starts a job importing users into a connection.
users is the contents of a JSON file — either a binary, or a File.Stream for
something too large to hold in memory:
iex> Auth0Client.Management.Job.users_imports(File.read!("users.json"), "con_1")
iex> Auth0Client.Management.Job.users_imports(File.stream!("users.json"), "con_1", %{upsert: true})opts may carry upsert, external_id and send_completion_email. Auth0
answers 202; poll get/1, then errors/1 to see which records failed.
Unlike every other endpoint here, this one is multipart/form-data — Auth0
accepts no other encoding for it.