Class: FusionAuth::FusionAuthClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fusionauth/fusionauth_client.rb

Overview

This class is the the Ruby client library for the FusionAuth CIAM Platform https://fusionauth.io

Each method on this class calls one of the APIs for FusionAuth. In most cases, the methods will take either a Hash, an OpenStruct or any object that can be safely converted to JSON that conforms to the FusionAuth API interface. Likewise, most methods will return an OpenStruct that contains the response JSON from FusionAuth.

noinspection RubyInstanceMethodNamingConvention,RubyTooManyMethodsInspection,RubyParameterNamingConvention

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, base_url) ⇒ FusionAuthClient

Returns a new instance of FusionAuthClient.



32
33
34
35
36
37
38
# File 'lib/fusionauth/fusionauth_client.rb', line 32

def initialize(api_key, base_url)
  @api_key = api_key
  @base_url = base_url
  @connect_timeout = 1000
  @read_timeout = 2000
  @tenant_id = nil
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def base_url
  @base_url
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def connect_timeout
  @connect_timeout
end

#read_timeoutObject

Returns the value of attribute read_timeout.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def read_timeout
  @read_timeout
end

#tenant_idObject

Returns the value of attribute tenant_id.



30
31
32
# File 'lib/fusionauth/fusionauth_client.rb', line 30

def tenant_id
  @tenant_id
end

Instance Method Details

#action_user(request) ⇒ FusionAuth::ClientResponse

Takes an action on a user. The user being actioned is called the “actionee” and the user taking the action is called the “actioner”. Both user ids are required in the request object.

Parameters:

  • request (OpenStruct, Hash)

    The action request that includes all of the information about the action being taken including the id of the action, any options and the duration (if applicable).

Returns:



51
52
53
54
55
56
# File 'lib/fusionauth/fusionauth_client.rb', line 51

def action_user(request)
  start.uri('/api/user/action')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#add_user_to_family(family_id, request) ⇒ FusionAuth::ClientResponse

Adds a user to an existing family. The family id must be specified.

Parameters:

  • family_id (string)

    The id of the family.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to determine which user to add to the family.

Returns:



64
65
66
67
68
69
70
# File 'lib/fusionauth/fusionauth_client.rb', line 64

def add_user_to_family(family_id, request)
  start.uri('/api/user/family')
      .url_segment(family_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#cancel_action(action_id, request) ⇒ FusionAuth::ClientResponse

Cancels the user action.

Parameters:

  • action_id (string)

    The action id of the action to cancel.

  • request (OpenStruct, Hash)

    The action request that contains the information about the cancellation.

Returns:



78
79
80
81
82
83
84
# File 'lib/fusionauth/fusionauth_client.rb', line 78

def cancel_action(action_id, request)
  start.uri('/api/user/action')
      .url_segment(action_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .delete()
      .go()
end

#change_password(change_password_id, request) ⇒ FusionAuth::ClientResponse

Changes a user’s password using the change password Id. This usually occurs after an email has been sent to the user and they clicked on a link to reset their password.

Parameters:

  • change_password_id (string)

    The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.

  • request (OpenStruct, Hash)

    The change password request that contains all of the information used to change the password.

Returns:



93
94
95
96
97
98
99
# File 'lib/fusionauth/fusionauth_client.rb', line 93

def change_password(change_password_id, request)
  start.uri('/api/user/change-password')
      .url_segment(change_password_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#change_password_by_identity(request) ⇒ FusionAuth::ClientResponse

Changes a user’s password using their identity (login id and password). Using a loginId instead of the changePasswordId bypasses the email verification and allows a password to be changed directly without first calling the #forgotPassword method.

Parameters:

  • request (OpenStruct, Hash)

    The change password request that contains all of the information used to change the password.

Returns:



108
109
110
111
112
113
# File 'lib/fusionauth/fusionauth_client.rb', line 108

def change_password_by_identity(request)
  start.uri('/api/user/change-password')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#comment_on_user(request) ⇒ FusionAuth::ClientResponse

Adds a comment to the user’s account.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user comment.

Returns:



120
121
122
123
124
125
# File 'lib/fusionauth/fusionauth_client.rb', line 120

def comment_on_user(request)
  start.uri('/api/user/comment')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_application(application_id, request) ⇒ FusionAuth::ClientResponse

Creates an application. You can optionally specify an Id for the application, if not provided one will be generated.

Parameters:

  • application_id (string)

    (Optional) The Id to use for the application. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the application.

Returns:



133
134
135
136
137
138
139
# File 'lib/fusionauth/fusionauth_client.rb', line 133

def create_application(application_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_application_role(application_id, role_id, request) ⇒ FusionAuth::ClientResponse

Creates a new role for an application. You must specify the id of the application you are creating the role for. You can optionally specify an Id for the role inside the ApplicationRole object itself, if not provided one will be generated.

Parameters:

  • application_id (string)

    The Id of the application to create the role on.

  • role_id (string)

    (Optional) The Id of the role. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the application role.

Returns:



149
150
151
152
153
154
155
156
157
# File 'lib/fusionauth/fusionauth_client.rb', line 149

def create_application_role(application_id, role_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_segment("role")
      .url_segment(role_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_audit_log(request) ⇒ FusionAuth::ClientResponse

Creates an audit log with the message and user name (usually an email). Audit logs should be written anytime you make changes to the FusionAuth database. When using the FusionAuth App web interface, any changes are automatically written to the audit log. However, if you are accessing the API, you must write the audit logs yourself.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the audit log entry.

Returns:



166
167
168
169
170
171
# File 'lib/fusionauth/fusionauth_client.rb', line 166

def create_audit_log(request)
  start.uri('/api/system/audit-log')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

Creates a user consent type. You can optionally specify an Id for the consent type, if not provided one will be generated.

Parameters:

  • consent_id (string)

    (Optional) The Id for the consent. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the consent.

Returns:



179
180
181
182
183
184
185
# File 'lib/fusionauth/fusionauth_client.rb', line 179

def create_consent(consent_id, request)
  start.uri('/api/consent')
      .url_segment(consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_email_template(email_template_id, request) ⇒ FusionAuth::ClientResponse

Creates an email template. You can optionally specify an Id for the template, if not provided one will be generated.

Parameters:

  • email_template_id (string)

    (Optional) The Id for the template. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the email template.

Returns:



193
194
195
196
197
198
199
# File 'lib/fusionauth/fusionauth_client.rb', line 193

def create_email_template(email_template_id, request)
  start.uri('/api/email/template')
      .url_segment(email_template_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_family(family_id, request) ⇒ FusionAuth::ClientResponse

Creates a family with the user id in the request as the owner and sole member of the family. You can optionally specify an id for the family, if not provided one will be generated.

Parameters:

  • family_id (string)

    (Optional) The id for the family. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the family.

Returns:



208
209
210
211
212
213
214
# File 'lib/fusionauth/fusionauth_client.rb', line 208

def create_family(family_id, request)
  start.uri('/api/user/family')
      .url_segment(family_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_group(group_id, request) ⇒ FusionAuth::ClientResponse

Creates a group. You can optionally specify an Id for the group, if not provided one will be generated.

Parameters:

  • group_id (string)

    (Optional) The Id for the group. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the group.

Returns:



222
223
224
225
226
227
228
# File 'lib/fusionauth/fusionauth_client.rb', line 222

def create_group(group_id, request)
  start.uri('/api/group')
      .url_segment(group_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_group_members(request) ⇒ FusionAuth::ClientResponse

Creates a member in a group.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the group member(s).

Returns:



235
236
237
238
239
240
# File 'lib/fusionauth/fusionauth_client.rb', line 235

def create_group_members(request)
  start.uri('/api/group/member')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_identity_provider(identity_provider_id, request) ⇒ FusionAuth::ClientResponse

Creates an identity provider. You can optionally specify an Id for the identity provider, if not provided one will be generated.

Parameters:

  • identity_provider_id (string)

    (Optional) The Id of the identity provider. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the identity provider.

Returns:



248
249
250
251
252
253
254
# File 'lib/fusionauth/fusionauth_client.rb', line 248

def create_identity_provider(identity_provider_id, request)
  start.uri('/api/identity-provider')
      .url_segment(identity_provider_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_lambda(lambda_id, request) ⇒ FusionAuth::ClientResponse

Creates a Lambda. You can optionally specify an Id for the lambda, if not provided one will be generated.

Parameters:

  • lambda_id (string)

    (Optional) The Id for the lambda. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the lambda.

Returns:



262
263
264
265
266
267
268
# File 'lib/fusionauth/fusionauth_client.rb', line 262

def create_lambda(lambda_id, request)
  start.uri('/api/lambda')
      .url_segment(lambda_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_tenant(tenant_id, request) ⇒ FusionAuth::ClientResponse

Creates a tenant. You can optionally specify an Id for the tenant, if not provided one will be generated.

Parameters:

  • tenant_id (string)

    (Optional) The Id for the tenant. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the tenant.

Returns:



276
277
278
279
280
281
282
# File 'lib/fusionauth/fusionauth_client.rb', line 276

def create_tenant(tenant_id, request)
  start.uri('/api/tenant')
      .url_segment(tenant_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_theme(theme_id, request) ⇒ FusionAuth::ClientResponse

Creates a Theme. You can optionally specify an Id for the theme, if not provided one will be generated.

Parameters:

  • theme_id (string)

    (Optional) The Id for the theme. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the theme.

Returns:



290
291
292
293
294
295
296
# File 'lib/fusionauth/fusionauth_client.rb', line 290

def create_theme(theme_id, request)
  start.uri('/api/theme')
      .url_segment(theme_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_user(user_id, request) ⇒ FusionAuth::ClientResponse

Creates a user. You can optionally specify an Id for the user, if not provided one will be generated.

Parameters:

  • user_id (string)

    (Optional) The Id for the user. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user.

Returns:



304
305
306
307
308
309
310
# File 'lib/fusionauth/fusionauth_client.rb', line 304

def create_user(user_id, request)
  start.uri('/api/user')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_user_action(user_action_id, request) ⇒ FusionAuth::ClientResponse

Creates a user action. This action cannot be taken on a user until this call successfully returns. Anytime after that the user action can be applied to any user.

Parameters:

  • user_action_id (string)

    (Optional) The Id for the user action. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user action.

Returns:



319
320
321
322
323
324
325
# File 'lib/fusionauth/fusionauth_client.rb', line 319

def create_user_action(user_action_id, request)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_user_action_reason(user_action_reason_id, request) ⇒ FusionAuth::ClientResponse

Creates a user reason. This user action reason cannot be used when actioning a user until this call completes successfully. Anytime after that the user action reason can be used.

Parameters:

  • user_action_reason_id (string)

    (Optional) The Id for the user action reason. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the user action reason.

Returns:



334
335
336
337
338
339
340
# File 'lib/fusionauth/fusionauth_client.rb', line 334

def create_user_action_reason(user_action_reason_id, request)
  start.uri('/api/user-action-reason')
      .url_segment(user_action_reason_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

Creates a single User consent.

Parameters:

  • user_consent_id (string)

    (Optional) The Id for the User consent. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request that contains the user consent information.

Returns:



348
349
350
351
352
353
354
# File 'lib/fusionauth/fusionauth_client.rb', line 348

def create_user_consent(user_consent_id, request)
  start.uri('/api/user/consent')
      .url_segment(user_consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#create_webhook(webhook_id, request) ⇒ FusionAuth::ClientResponse

Creates a webhook. You can optionally specify an Id for the webhook, if not provided one will be generated.

Parameters:

  • webhook_id (string)

    (Optional) The Id for the webhook. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the webhook.

Returns:



362
363
364
365
366
367
368
# File 'lib/fusionauth/fusionauth_client.rb', line 362

def create_webhook(webhook_id, request)
  start.uri('/api/webhook')
      .url_segment(webhook_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#deactivate_application(application_id) ⇒ FusionAuth::ClientResponse

Deactivates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to deactivate.

Returns:



375
376
377
378
379
380
# File 'lib/fusionauth/fusionauth_client.rb', line 375

def deactivate_application(application_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .delete()
      .go()
end

#deactivate_user(user_id) ⇒ FusionAuth::ClientResponse

Deactivates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to deactivate.

Returns:



387
388
389
390
391
392
# File 'lib/fusionauth/fusionauth_client.rb', line 387

def deactivate_user(user_id)
  start.uri('/api/user')
      .url_segment(user_id)
      .delete()
      .go()
end

#deactivate_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Deactivates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to deactivate.

Returns:



399
400
401
402
403
404
# File 'lib/fusionauth/fusionauth_client.rb', line 399

def deactivate_user_action(user_action_id)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .delete()
      .go()
end

#deactivate_users(user_ids) ⇒ FusionAuth::ClientResponse

Deprecated.

This method has been renamed to deactivate_users_by_ids, use that method instead.

Deactivates the users with the given ids.

Parameters:

  • user_ids (Array)

    The ids of the users to deactivate.

Returns:



412
413
414
415
416
417
418
419
# File 'lib/fusionauth/fusionauth_client.rb', line 412

def deactivate_users(user_ids)
  start.uri('/api/user/bulk')
      .url_parameter('userId', user_ids)
      .url_parameter('dryRun', false)
      .url_parameter('hardDelete', false)
      .delete()
      .go()
end

#deactivate_users_by_ids(user_ids) ⇒ FusionAuth::ClientResponse

Deactivates the users with the given ids.

Parameters:

  • user_ids (Array)

    The ids of the users to deactivate.

Returns:



426
427
428
429
430
431
432
433
# File 'lib/fusionauth/fusionauth_client.rb', line 426

def deactivate_users_by_ids(user_ids)
  start.uri('/api/user/bulk')
      .url_parameter('userId', user_ids)
      .url_parameter('dryRun', false)
      .url_parameter('hardDelete', false)
      .delete()
      .go()
end

#delete_application(application_id) ⇒ FusionAuth::ClientResponse

Hard deletes an application. This is a dangerous operation and should not be used in most circumstances. This will delete the application, any registrations for that application, metrics and reports for the application, all the roles for the application, and any other data associated with the application. This operation could take a very long time, depending on the amount of data in your database.

Parameters:

  • application_id (string)

    The Id of the application to delete.

Returns:



443
444
445
446
447
448
449
# File 'lib/fusionauth/fusionauth_client.rb', line 443

def delete_application(application_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_parameter('hardDelete', true)
      .delete()
      .go()
end

#delete_application_role(application_id, role_id) ⇒ FusionAuth::ClientResponse

Hard deletes an application role. This is a dangerous operation and should not be used in most circumstances. This permanently removes the given role from all users that had it.

Parameters:

  • application_id (string)

    The Id of the application to deactivate.

  • role_id (string)

    The Id of the role to delete.

Returns:



458
459
460
461
462
463
464
465
# File 'lib/fusionauth/fusionauth_client.rb', line 458

def delete_application_role(application_id, role_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_segment("role")
      .url_segment(role_id)
      .delete()
      .go()
end

Deletes the consent for the given Id.

Parameters:

  • consent_id (string)

    The Id of the consent to delete.

Returns:



472
473
474
475
476
477
# File 'lib/fusionauth/fusionauth_client.rb', line 472

def delete_consent(consent_id)
  start.uri('/api/consent')
      .url_segment(consent_id)
      .delete()
      .go()
end

#delete_email_template(email_template_id) ⇒ FusionAuth::ClientResponse

Deletes the email template for the given Id.

Parameters:

  • email_template_id (string)

    The Id of the email template to delete.

Returns:



484
485
486
487
488
489
# File 'lib/fusionauth/fusionauth_client.rb', line 484

def delete_email_template(email_template_id)
  start.uri('/api/email/template')
      .url_segment(email_template_id)
      .delete()
      .go()
end

#delete_group(group_id) ⇒ FusionAuth::ClientResponse

Deletes the group for the given Id.

Parameters:

  • group_id (string)

    The Id of the group to delete.

Returns:



496
497
498
499
500
501
# File 'lib/fusionauth/fusionauth_client.rb', line 496

def delete_group(group_id)
  start.uri('/api/group')
      .url_segment(group_id)
      .delete()
      .go()
end

#delete_group_members(request) ⇒ FusionAuth::ClientResponse

Removes users as members of a group.

Parameters:

  • request (OpenStruct, Hash)

    The member request that contains all of the information used to remove members to the group.

Returns:



508
509
510
511
512
513
# File 'lib/fusionauth/fusionauth_client.rb', line 508

def delete_group_members(request)
  start.uri('/api/group/member')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .delete()
      .go()
end

#delete_identity_provider(identity_provider_id) ⇒ FusionAuth::ClientResponse

Deletes the identity provider for the given Id.

Parameters:

  • identity_provider_id (string)

    The Id of the identity provider to delete.

Returns:



520
521
522
523
524
525
# File 'lib/fusionauth/fusionauth_client.rb', line 520

def delete_identity_provider(identity_provider_id)
  start.uri('/api/identity-provider')
      .url_segment(identity_provider_id)
      .delete()
      .go()
end

#delete_key(key_od) ⇒ FusionAuth::ClientResponse

Deletes the key for the given Id.

Parameters:

  • key_od (string)

    The Id of the key to delete.

Returns:



532
533
534
535
536
537
# File 'lib/fusionauth/fusionauth_client.rb', line 532

def delete_key(key_od)
  start.uri('/api/key')
      .url_segment(key_od)
      .delete()
      .go()
end

#delete_lambda(lambda_id) ⇒ FusionAuth::ClientResponse

Deletes the lambda for the given Id.

Parameters:

  • lambda_id (string)

    The Id of the lambda to delete.

Returns:



544
545
546
547
548
549
# File 'lib/fusionauth/fusionauth_client.rb', line 544

def delete_lambda(lambda_id)
  start.uri('/api/lambda')
      .url_segment(lambda_id)
      .delete()
      .go()
end

#delete_registration(user_id, application_id) ⇒ FusionAuth::ClientResponse

Deletes the user registration for the given user and application.

Parameters:

  • user_id (string)

    The Id of the user whose registration is being deleted.

  • application_id (string)

    The Id of the application to remove the registration for.

Returns:



557
558
559
560
561
562
563
# File 'lib/fusionauth/fusionauth_client.rb', line 557

def delete_registration(user_id, application_id)
  start.uri('/api/user/registration')
      .url_segment(user_id)
      .url_segment(application_id)
      .delete()
      .go()
end

#delete_tenant(tenant_id) ⇒ FusionAuth::ClientResponse

Deletes the tenant for the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant to delete.

Returns:



570
571
572
573
574
575
# File 'lib/fusionauth/fusionauth_client.rb', line 570

def delete_tenant(tenant_id)
  start.uri('/api/tenant')
      .url_segment(tenant_id)
      .delete()
      .go()
end

#delete_theme(theme_id) ⇒ FusionAuth::ClientResponse

Deletes the theme for the given Id.

Parameters:

  • theme_id (string)

    The Id of the theme to delete.

Returns:



582
583
584
585
586
587
# File 'lib/fusionauth/fusionauth_client.rb', line 582

def delete_theme(theme_id)
  start.uri('/api/theme')
      .url_segment(theme_id)
      .delete()
      .go()
end

#delete_user(user_id) ⇒ FusionAuth::ClientResponse

Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated with the user.

Parameters:

  • user_id (string)

    The Id of the user to delete.

Returns:



595
596
597
598
599
600
601
# File 'lib/fusionauth/fusionauth_client.rb', line 595

def delete_user(user_id)
  start.uri('/api/user')
      .url_segment(user_id)
      .url_parameter('hardDelete', true)
      .delete()
      .go()
end

#delete_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Deletes the user action for the given Id. This permanently deletes the user action and also any history and logs of the action being applied to any users.

Parameters:

  • user_action_id (string)

    The Id of the user action to delete.

Returns:



609
610
611
612
613
614
615
# File 'lib/fusionauth/fusionauth_client.rb', line 609

def delete_user_action(user_action_id)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .url_parameter('hardDelete', true)
      .delete()
      .go()
end

#delete_user_action_reason(user_action_reason_id) ⇒ FusionAuth::ClientResponse

Deletes the user action reason for the given Id.

Parameters:

  • user_action_reason_id (string)

    The Id of the user action reason to delete.

Returns:



622
623
624
625
626
627
# File 'lib/fusionauth/fusionauth_client.rb', line 622

def delete_user_action_reason(user_action_reason_id)
  start.uri('/api/user-action-reason')
      .url_segment(user_action_reason_id)
      .delete()
      .go()
end

#delete_users(request) ⇒ FusionAuth::ClientResponse

Deprecated.

This method has been renamed to delete_users_by_query, use that method instead.

Deletes the users with the given ids, or users matching the provided JSON query or queryString. The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.

This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body. Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.

Parameters:

  • request (OpenStruct, Hash)

    The UserDeleteRequest.

Returns:



639
640
641
642
643
644
# File 'lib/fusionauth/fusionauth_client.rb', line 639

def delete_users(request)
  start.uri('/api/user/bulk')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .delete()
      .go()
end

#delete_users_by_query(request) ⇒ FusionAuth::ClientResponse

Deletes the users with the given ids, or users matching the provided JSON query or queryString. The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.

This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body. Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.

Parameters:

  • request (OpenStruct, Hash)

    The UserDeleteRequest.

Returns:



655
656
657
658
659
660
# File 'lib/fusionauth/fusionauth_client.rb', line 655

def delete_users_by_query(request)
  start.uri('/api/user/bulk')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .delete()
      .go()
end

#delete_webhook(webhook_id) ⇒ FusionAuth::ClientResponse

Deletes the webhook for the given Id.

Parameters:

  • webhook_id (string)

    The Id of the webhook to delete.

Returns:



667
668
669
670
671
672
# File 'lib/fusionauth/fusionauth_client.rb', line 667

def delete_webhook(webhook_id)
  start.uri('/api/webhook')
      .url_segment(webhook_id)
      .delete()
      .go()
end

#disable_two_factor(user_id, code) ⇒ FusionAuth::ClientResponse

Disable Two Factor authentication for a user.

Parameters:

  • user_id (string)

    The Id of the User for which you’re disabling Two Factor authentication.

  • code (string)

    The Two Factor code used verify the the caller knows the Two Factor secret.

Returns:



680
681
682
683
684
685
686
# File 'lib/fusionauth/fusionauth_client.rb', line 680

def disable_two_factor(user_id, code)
  start.uri('/api/user/two-factor')
      .url_parameter('userId', user_id)
      .url_parameter('code', code)
      .delete()
      .go()
end

#enable_two_factor(user_id, request) ⇒ FusionAuth::ClientResponse

Enable Two Factor authentication for a user.

Parameters:

  • user_id (string)

    The Id of the user to enable Two Factor authentication.

  • request (OpenStruct, Hash)

    The two factor enable request information.

Returns:



694
695
696
697
698
699
700
# File 'lib/fusionauth/fusionauth_client.rb', line 694

def enable_two_factor(user_id, request)
  start.uri('/api/user/two-factor')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#exchange_o_auth_code_for_access_token(code, client_id, client_secret, redirect_uri) ⇒ FusionAuth::ClientResponse

Exchanges an OAuth authorization code for an access token. If you will be using the Authorization Code grant, you will make a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.

Parameters:

  • code (string)

    The authorization code returned on the /oauth2/authorize response.

  • client_id (string)

    (Optional) The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate. This parameter is optional when the Authorization header is provided.

  • client_secret (string)

    (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.

  • redirect_uri (string)

    The URI to redirect to upon a successful request.

Returns:



711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/fusionauth/fusionauth_client.rb', line 711

def exchange_o_auth_code_for_access_token(code, client_id, client_secret, redirect_uri)
  body = {
    "code" => code,
    "client_id" => client_id,
    "client_secret" => client_secret,
    "grant_type" => "authorization_code",
    "redirect_uri" => redirect_uri
  }
  startAnonymous.uri('/oauth2/token')
      .body_handler(FusionAuth::FormDataBodyHandler.new(body))
      .post()
      .go()
end

#exchange_refresh_token_for_access_token(refresh_token, client_id, client_secret, scope, user_code) ⇒ FusionAuth::ClientResponse

Exchange a Refresh Token for an Access Token. If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.

Parameters:

  • refresh_token (string)

    The refresh token that you would like to use to exchange for an access token.

  • client_id (string)

    (Optional) The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate. This parameter is optional when the Authorization header is provided.

  • client_secret (string)

    (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.

  • scope (string)

    (Optional) This parameter is optional and if omitted, the same scope requested during the authorization request will be used. If provided the scopes must match those requested during the initial authorization request.

  • user_code (string)

    (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.

Returns:



735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/fusionauth/fusionauth_client.rb', line 735

def exchange_refresh_token_for_access_token(refresh_token, client_id, client_secret, scope, user_code)
  body = {
    "refresh_token" => refresh_token,
    "client_id" => client_id,
    "client_secret" => client_secret,
    "grant_type" => "refresh_token",
    "scope" => scope,
    "user_code" => user_code
  }
  startAnonymous.uri('/oauth2/token')
      .body_handler(FusionAuth::FormDataBodyHandler.new(body))
      .post()
      .go()
end

#exchange_refresh_token_for_jwt(request) ⇒ FusionAuth::ClientResponse

Exchange a refresh token for a new JWT.

Parameters:

  • request (OpenStruct, Hash)

    The refresh request.

Returns:



755
756
757
758
759
760
# File 'lib/fusionauth/fusionauth_client.rb', line 755

def exchange_refresh_token_for_jwt(request)
  startAnonymous.uri('/api/jwt/refresh')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#exchange_user_credentials_for_access_token(username, password, client_id, client_secret, scope, user_code) ⇒ FusionAuth::ClientResponse

Exchange User Credentials for a Token. If you will be using the Resource Owner Password Credential Grant, you will make a request to the Token endpoint to exchange the user’s email and password for an access token.

Parameters:

  • username (string)

    The login identifier of the user. The login identifier can be either the email or the username.

  • password (string)

    The user’s password.

  • client_id (string)

    (Optional) The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate. This parameter is optional when the Authorization header is provided.

  • client_secret (string)

    (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.

  • scope (string)

    (Optional) This parameter is optional and if omitted, the same scope requested during the authorization request will be used. If provided the scopes must match those requested during the initial authorization request.

  • user_code (string)

    (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.

Returns:



773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
# File 'lib/fusionauth/fusionauth_client.rb', line 773

def exchange_user_credentials_for_access_token(username, password, client_id, client_secret, scope, user_code)
  body = {
    "username" => username,
    "password" => password,
    "client_id" => client_id,
    "client_secret" => client_secret,
    "grant_type" => "password",
    "scope" => scope,
    "user_code" => user_code
  }
  startAnonymous.uri('/oauth2/token')
      .body_handler(FusionAuth::FormDataBodyHandler.new(body))
      .post()
      .go()
end

#forgot_password(request) ⇒ FusionAuth::ClientResponse

Begins the forgot password sequence, which kicks off an email to the user so that they can reset their password.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains the information about the user so that they can be emailed.

Returns:



794
795
796
797
798
799
# File 'lib/fusionauth/fusionauth_client.rb', line 794

def forgot_password(request)
  start.uri('/api/user/forgot-password')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#generate_email_verification_id(email) ⇒ FusionAuth::ClientResponse

Generate a new Email Verification Id to be used with the Verify Email API. This API will not attempt to send an email to the User. This API may be used to collect the verificationId for use with a third party system.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

Returns:



807
808
809
810
811
812
813
# File 'lib/fusionauth/fusionauth_client.rb', line 807

def generate_email_verification_id(email)
  start.uri('/api/user/verify-email')
      .url_parameter('email', email)
      .url_parameter('sendVerifyEmail', false)
      .put()
      .go()
end

#generate_key(key_id, request) ⇒ FusionAuth::ClientResponse

Generate a new RSA or EC key pair or an HMAC secret.

Parameters:

  • key_id (string)

    (Optional) The Id for the key. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the key.

Returns:



821
822
823
824
825
826
827
# File 'lib/fusionauth/fusionauth_client.rb', line 821

def generate_key(key_id, request)
  start.uri('/api/key/generate')
      .url_segment(key_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#generate_registration_verification_id(email, application_id) ⇒ FusionAuth::ClientResponse

Generate a new Application Registration Verification Id to be used with the Verify Registration API. This API will not attempt to send an email to the User. This API may be used to collect the verificationId for use with a third party system.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

  • application_id (string)

    The Id of the application to be verified.

Returns:



836
837
838
839
840
841
842
843
# File 'lib/fusionauth/fusionauth_client.rb', line 836

def generate_registration_verification_id(email, application_id)
  start.uri('/api/user/verify-registration')
      .url_parameter('email', email)
      .url_parameter('sendVerifyPasswordEmail', false)
      .url_parameter('applicationId', application_id)
      .put()
      .go()
end

#generate_two_factor_secretFusionAuth::ClientResponse

Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication application such as Google Authenticator.

Returns:



851
852
853
854
855
# File 'lib/fusionauth/fusionauth_client.rb', line 851

def generate_two_factor_secret()
  start.uri('/api/two-factor/secret')
      .get()
      .go()
end

#generate_two_factor_secret_using_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication application such as Google Authenticator.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



864
865
866
867
868
869
# File 'lib/fusionauth/fusionauth_client.rb', line 864

def generate_two_factor_secret_using_jwt(encoded_jwt)
  start.uri('/api/two-factor/secret')
      .authorization('JWT ' + encoded_jwt)
      .get()
      .go()
end

#identity_provider_login(request) ⇒ FusionAuth::ClientResponse

Handles login via third-parties including Social login, external OAuth and OpenID Connect, and other login systems.

Parameters:

  • request (OpenStruct, Hash)

    The third-party login request that contains information from the third-party login providers that FusionAuth uses to reconcile the user’s account.

Returns:



878
879
880
881
882
883
# File 'lib/fusionauth/fusionauth_client.rb', line 878

def (request)
  startAnonymous.uri('/api/identity-provider/login')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#import_key(key_id, request) ⇒ FusionAuth::ClientResponse

Import an existing RSA or EC key pair or an HMAC secret.

Parameters:

  • key_id (string)

    (Optional) The Id for the key. If not provided a secure random UUID will be generated.

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to create the key.

Returns:



891
892
893
894
895
896
897
# File 'lib/fusionauth/fusionauth_client.rb', line 891

def import_key(key_id, request)
  start.uri('/api/key/import')
      .url_segment(key_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#import_users(request) ⇒ FusionAuth::ClientResponse

Bulk imports multiple users. This does some validation, but then tries to run batch inserts of users. This reduces latency when inserting lots of users. Therefore, the error response might contain some information about failures, but it will likely be pretty generic.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the information about all of the users to import.

Returns:



906
907
908
909
910
911
# File 'lib/fusionauth/fusionauth_client.rb', line 906

def import_users(request)
  start.uri('/api/user/import')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#issue_jwt(application_id, encoded_jwt, refresh_token) ⇒ FusionAuth::ClientResponse

Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid access token is properly signed and not expired. <p> This API may be used in an SSO configuration to issue new tokens for another application after the user has obtained a valid token from authentication.

Parameters:

  • application_id (string)

    The Application Id for which you are requesting a new access token be issued.

  • encoded_jwt (string)

    The encoded JWT (access token).

  • refresh_token (string)

    (Optional) An existing refresh token used to request a refresh token in addition to a JWT in the response. <p>The target application represented by the applicationid request parameter must have refresh tokens enabled in order to receive a refresh token in the response.</p>

Returns:



926
927
928
929
930
931
932
933
# File 'lib/fusionauth/fusionauth_client.rb', line 926

def issue_jwt(application_id, encoded_jwt, refresh_token)
  start.uri('/api/jwt/issue')
      .authorization('JWT ' + encoded_jwt)
      .url_parameter('applicationId', application_id)
      .url_parameter('refreshToken', refresh_token)
      .get()
      .go()
end

#login(request) ⇒ FusionAuth::ClientResponse

Authenticates a user to FusionAuth.

This API optionally requires an API key. See Application.loginConfiguration.requireAuthentication.

Parameters:

  • request (OpenStruct, Hash)

    The login request that contains the user credentials used to log them in.

Returns:



942
943
944
945
946
947
# File 'lib/fusionauth/fusionauth_client.rb', line 942

def (request)
  start.uri('/api/login')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#login_ping(user_id, application_id, caller_ip_address) ⇒ FusionAuth::ClientResponse

Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using FusionAuth’s SSO or your own, you should call this if the user is already logged in centrally, but accesses an application where they no longer have a session. This helps correctly track login counts, times and helps with reporting.

Parameters:

  • user_id (string)

    The Id of the user that was logged in.

  • application_id (string)

    The Id of the application that they logged into.

  • caller_ip_address (string)

    (Optional) The IP address of the end-user that is logging in. If a null value is provided the IP address will be that of the client or last proxy that sent the request.

Returns:



960
961
962
963
964
965
966
967
# File 'lib/fusionauth/fusionauth_client.rb', line 960

def (user_id, application_id, caller_ip_address)
  start.uri('/api/login')
      .url_segment(user_id)
      .url_segment(application_id)
      .url_parameter('ipAddress', caller_ip_address)
      .put()
      .go()
end

#logout(global, refresh_token) ⇒ FusionAuth::ClientResponse

The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the client and revoke the refresh token stored. This API does nothing if the request does not contain an access token or refresh token cookies.

Parameters:

  • global (Boolean)

    When this value is set to true all of the refresh tokens issued to the owner of the provided token will be revoked.

  • refresh_token (string)

    (Optional) The refresh_token as a request parameter instead of coming in via a cookie. If provided this takes precedence over the cookie.

Returns:



979
980
981
982
983
984
985
# File 'lib/fusionauth/fusionauth_client.rb', line 979

def logout(global, refresh_token)
  startAnonymous.uri('/api/logout')
      .url_parameter('global', global)
      .url_parameter('refreshToken', refresh_token)
      .post()
      .go()
end

#lookup_identity_provider(domain) ⇒ FusionAuth::ClientResponse

Retrieves the identity provider for the given domain. A 200 response code indicates the domain is managed by a registered identity provider. A 404 indicates the domain is not managed.

Parameters:

  • domain (string)

    The domain or email address to lookup.

Returns:



993
994
995
996
997
998
# File 'lib/fusionauth/fusionauth_client.rb', line 993

def lookup_identity_provider(domain)
  start.uri('/api/identity-provider/lookup')
      .url_parameter('domain', domain)
      .get()
      .go()
end

#modify_action(action_id, request) ⇒ FusionAuth::ClientResponse

Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the action.

Parameters:

  • action_id (string)

    The Id of the action to modify. This is technically the user action log id.

  • request (OpenStruct, Hash)

    The request that contains all of the information about the modification.

Returns:



1007
1008
1009
1010
1011
1012
1013
# File 'lib/fusionauth/fusionauth_client.rb', line 1007

def modify_action(action_id, request)
  start.uri('/api/user/action')
      .url_segment(action_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#passwordless_login(request) ⇒ FusionAuth::ClientResponse

Complete a login request using a passwordless code

Parameters:

  • request (OpenStruct, Hash)

    The passwordless login request that contains all of the information used to complete login.

Returns:



1020
1021
1022
1023
1024
1025
# File 'lib/fusionauth/fusionauth_client.rb', line 1020

def (request)
  startAnonymous.uri('/api/passwordless/login')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#patch_application(application_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to update.

  • request (OpenStruct, Hash)

    The request that contains just the new application information.

Returns:



1033
1034
1035
1036
1037
1038
1039
# File 'lib/fusionauth/fusionauth_client.rb', line 1033

def patch_application(application_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_application_role(application_id, role_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the application role with the given id for the application.

Parameters:

  • application_id (string)

    The Id of the application that the role belongs to.

  • role_id (string)

    The Id of the role to update.

  • request (OpenStruct, Hash)

    The request that contains just the new role information.

Returns:



1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/fusionauth/fusionauth_client.rb', line 1048

def patch_application_role(application_id, role_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_segment("role")
      .url_segment(role_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

Updates, via PATCH, the consent with the given Id.

Parameters:

  • consent_id (string)

    The Id of the consent to update.

  • request (OpenStruct, Hash)

    The request that contains just the new consent information.

Returns:



1064
1065
1066
1067
1068
1069
1070
# File 'lib/fusionauth/fusionauth_client.rb', line 1064

def patch_consent(consent_id, request)
  start.uri('/api/consent')
      .url_segment(consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_email_template(email_template_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the email template with the given Id.

Parameters:

  • email_template_id (string)

    The Id of the email template to update.

  • request (OpenStruct, Hash)

    The request that contains just the new email template information.

Returns:



1078
1079
1080
1081
1082
1083
1084
# File 'lib/fusionauth/fusionauth_client.rb', line 1078

def patch_email_template(email_template_id, request)
  start.uri('/api/email/template')
      .url_segment(email_template_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_group(group_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the group with the given Id.

Parameters:

  • group_id (string)

    The Id of the group to update.

  • request (OpenStruct, Hash)

    The request that contains just the new group information.

Returns:



1092
1093
1094
1095
1096
1097
1098
# File 'lib/fusionauth/fusionauth_client.rb', line 1092

def patch_group(group_id, request)
  start.uri('/api/group')
      .url_segment(group_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_identity_provider(identity_provider_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the identity provider with the given Id.

Parameters:

  • identity_provider_id (string)

    The Id of the identity provider to update.

  • request (OpenStruct, Hash)

    The request object that contains just the updated identity provider information.

Returns:



1106
1107
1108
1109
1110
1111
1112
# File 'lib/fusionauth/fusionauth_client.rb', line 1106

def patch_identity_provider(identity_provider_id, request)
  start.uri('/api/identity-provider')
      .url_segment(identity_provider_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_integrations(request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the available integrations.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains just the new integration information.

Returns:



1119
1120
1121
1122
1123
1124
# File 'lib/fusionauth/fusionauth_client.rb', line 1119

def patch_integrations(request)
  start.uri('/api/integration')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_lambda(lambda_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the lambda with the given Id.

Parameters:

  • lambda_id (string)

    The Id of the lambda to update.

  • request (OpenStruct, Hash)

    The request that contains just the new lambda information.

Returns:



1132
1133
1134
1135
1136
1137
1138
# File 'lib/fusionauth/fusionauth_client.rb', line 1132

def patch_lambda(lambda_id, request)
  start.uri('/api/lambda')
      .url_segment(lambda_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_registration(user_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the registration for the user with the given id and the application defined in the request.

Parameters:

  • user_id (string)

    The Id of the user whose registration is going to be updated.

  • request (OpenStruct, Hash)

    The request that contains just the new registration information.

Returns:



1146
1147
1148
1149
1150
1151
1152
# File 'lib/fusionauth/fusionauth_client.rb', line 1146

def patch_registration(user_id, request)
  start.uri('/api/user/registration')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_system_configuration(request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the system configuration.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains just the new system configuration information.

Returns:



1159
1160
1161
1162
1163
1164
# File 'lib/fusionauth/fusionauth_client.rb', line 1159

def patch_system_configuration(request)
  start.uri('/api/system-configuration')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_tenant(tenant_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the tenant with the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant to update.

  • request (OpenStruct, Hash)

    The request that contains just the new tenant information.

Returns:



1172
1173
1174
1175
1176
1177
1178
# File 'lib/fusionauth/fusionauth_client.rb', line 1172

def patch_tenant(tenant_id, request)
  start.uri('/api/tenant')
      .url_segment(tenant_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_theme(theme_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the theme with the given Id.

Parameters:

  • theme_id (string)

    The Id of the theme to update.

  • request (OpenStruct, Hash)

    The request that contains just the new theme information.

Returns:



1186
1187
1188
1189
1190
1191
1192
# File 'lib/fusionauth/fusionauth_client.rb', line 1186

def patch_theme(theme_id, request)
  start.uri('/api/theme')
      .url_segment(theme_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_user(user_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to update.

  • request (OpenStruct, Hash)

    The request that contains just the new user information.

Returns:



1200
1201
1202
1203
1204
1205
1206
# File 'lib/fusionauth/fusionauth_client.rb', line 1200

def patch_user(user_id, request)
  start.uri('/api/user')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_user_action(user_action_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to update.

  • request (OpenStruct, Hash)

    The request that contains just the new user action information.

Returns:



1214
1215
1216
1217
1218
1219
1220
# File 'lib/fusionauth/fusionauth_client.rb', line 1214

def patch_user_action(user_action_id, request)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#patch_user_action_reason(user_action_reason_id, request) ⇒ FusionAuth::ClientResponse

Updates, via PATCH, the user action reason with the given Id.

Parameters:

  • user_action_reason_id (string)

    The Id of the user action reason to update.

  • request (OpenStruct, Hash)

    The request that contains just the new user action reason information.

Returns:



1228
1229
1230
1231
1232
1233
1234
# File 'lib/fusionauth/fusionauth_client.rb', line 1228

def patch_user_action_reason(user_action_reason_id, request)
  start.uri('/api/user-action-reason')
      .url_segment(user_action_reason_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

Updates, via PATCH, a single User consent by Id.

Parameters:

  • user_consent_id (string)

    The User Consent Id

  • request (OpenStruct, Hash)

    The request that contains just the new user consent information.

Returns:



1242
1243
1244
1245
1246
1247
1248
# File 'lib/fusionauth/fusionauth_client.rb', line 1242

def patch_user_consent(user_consent_id, request)
  start.uri('/api/user/consent')
      .url_segment(user_consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .patch()
      .go()
end

#reactivate_application(application_id) ⇒ FusionAuth::ClientResponse

Reactivates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to reactivate.

Returns:



1255
1256
1257
1258
1259
1260
1261
# File 'lib/fusionauth/fusionauth_client.rb', line 1255

def reactivate_application(application_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_parameter('reactivate', true)
      .put()
      .go()
end

#reactivate_user(user_id) ⇒ FusionAuth::ClientResponse

Reactivates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to reactivate.

Returns:



1268
1269
1270
1271
1272
1273
1274
# File 'lib/fusionauth/fusionauth_client.rb', line 1268

def reactivate_user(user_id)
  start.uri('/api/user')
      .url_segment(user_id)
      .url_parameter('reactivate', true)
      .put()
      .go()
end

#reactivate_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Reactivates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to reactivate.

Returns:



1281
1282
1283
1284
1285
1286
1287
# File 'lib/fusionauth/fusionauth_client.rb', line 1281

def reactivate_user_action(user_action_id)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .url_parameter('reactivate', true)
      .put()
      .go()
end

#reconcile_jwt(request) ⇒ FusionAuth::ClientResponse

Reconcile a User to FusionAuth using JWT issued from another Identity Provider.

Parameters:

  • request (OpenStruct, Hash)

    The reconcile request that contains the data to reconcile the User.

Returns:



1294
1295
1296
1297
1298
1299
# File 'lib/fusionauth/fusionauth_client.rb', line 1294

def reconcile_jwt(request)
  startAnonymous.uri('/api/jwt/reconcile')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#refresh_user_search_indexFusionAuth::ClientResponse

Request a refresh of the User search index. This API is not generally necessary and the search index will become consistent in a reasonable amount of time. There may be scenarios where you may wish to manually request an index refresh. One example may be if you are using the Search API or Delete Tenant API immediately following a User Create etc, you may wish to request a refresh to

ensure the index immediately current before making a query request to the search index.

Returns:



1308
1309
1310
1311
1312
# File 'lib/fusionauth/fusionauth_client.rb', line 1308

def refresh_user_search_index()
  start.uri('/api/user/search')
      .put()
      .go()
end

#register(user_id, request) ⇒ FusionAuth::ClientResponse

Registers a user for an application. If you provide the User and the UserRegistration object on this request, it will create the user as well as register them for the application. This is called a Full Registration. However, if you only provide the UserRegistration object, then the user must already exist and they will be registered for the application. The user id can also be provided and it will either be used to look up an existing user or it will be used for the newly created User.

Parameters:

  • user_id (string)

    (Optional) The Id of the user being registered for the application and optionally created.

  • request (OpenStruct, Hash)

    The request that optionally contains the User and must contain the UserRegistration.

Returns:



1324
1325
1326
1327
1328
1329
1330
# File 'lib/fusionauth/fusionauth_client.rb', line 1324

def register(user_id, request)
  start.uri('/api/user/registration')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#remove_user_from_family(family_id, user_id) ⇒ FusionAuth::ClientResponse

Removes a user from the family with the given id.

Parameters:

  • family_id (string)

    The id of the family to remove the user from.

  • user_id (string)

    The id of the user to remove from the family.

Returns:



1338
1339
1340
1341
1342
1343
1344
# File 'lib/fusionauth/fusionauth_client.rb', line 1338

def remove_user_from_family(family_id, user_id)
  start.uri('/api/user/family')
      .url_segment(family_id)
      .url_segment(user_id)
      .delete()
      .go()
end

#resend_email_verification(email) ⇒ FusionAuth::ClientResponse

Re-sends the verification email to the user.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

Returns:



1351
1352
1353
1354
1355
1356
# File 'lib/fusionauth/fusionauth_client.rb', line 1351

def resend_email_verification(email)
  start.uri('/api/user/verify-email')
      .url_parameter('email', email)
      .put()
      .go()
end

#resend_registration_verification(email, application_id) ⇒ FusionAuth::ClientResponse

Re-sends the application registration verification email to the user.

Parameters:

  • email (string)

    The email address of the user that needs a new verification email.

  • application_id (string)

    The Id of the application to be verified.

Returns:



1364
1365
1366
1367
1368
1369
1370
# File 'lib/fusionauth/fusionauth_client.rb', line 1364

def resend_registration_verification(email, application_id)
  start.uri('/api/user/verify-registration')
      .url_parameter('email', email)
      .url_parameter('applicationId', application_id)
      .put()
      .go()
end

#retrieve_action(action_id) ⇒ FusionAuth::ClientResponse

Retrieves a single action log (the log of a user action that was taken on a user previously) for the given Id.

Parameters:

  • action_id (string)

    The Id of the action to retrieve.

Returns:



1377
1378
1379
1380
1381
1382
# File 'lib/fusionauth/fusionauth_client.rb', line 1377

def retrieve_action(action_id)
  start.uri('/api/user/action')
      .url_segment(action_id)
      .get()
      .go()
end

#retrieve_actions(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the actions for the user with the given Id. This will return all time based actions that are active, and inactive as well as non-time based actions.

Parameters:

  • user_id (string)

    The Id of the user to fetch the actions for.

Returns:



1390
1391
1392
1393
1394
1395
# File 'lib/fusionauth/fusionauth_client.rb', line 1390

def retrieve_actions(user_id)
  start.uri('/api/user/action')
      .url_parameter('userId', user_id)
      .get()
      .go()
end

#retrieve_actions_preventing_login(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the actions for the user with the given Id that are currently preventing the User from logging in.

Parameters:

  • user_id (string)

    The Id of the user to fetch the actions for.

Returns:



1402
1403
1404
1405
1406
1407
1408
# File 'lib/fusionauth/fusionauth_client.rb', line 1402

def (user_id)
  start.uri('/api/user/action')
      .url_parameter('userId', user_id)
      .url_parameter('preventingLogin', true)
      .get()
      .go()
end

#retrieve_active_actions(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the actions for the user with the given Id that are currently active. An active action means one that is time based and has not been canceled, and has not ended.

Parameters:

  • user_id (string)

    The Id of the user to fetch the actions for.

Returns:



1416
1417
1418
1419
1420
1421
1422
# File 'lib/fusionauth/fusionauth_client.rb', line 1416

def retrieve_active_actions(user_id)
  start.uri('/api/user/action')
      .url_parameter('userId', user_id)
      .url_parameter('active', true)
      .get()
      .go()
end

#retrieve_application(application_id) ⇒ FusionAuth::ClientResponse

Retrieves the application for the given id or all of the applications if the id is null.

Parameters:

  • application_id (string)

    (Optional) The application id.

Returns:



1429
1430
1431
1432
1433
1434
# File 'lib/fusionauth/fusionauth_client.rb', line 1429

def retrieve_application(application_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .get()
      .go()
end

#retrieve_applicationsFusionAuth::ClientResponse

Retrieves all of the applications.

Returns:



1440
1441
1442
1443
1444
# File 'lib/fusionauth/fusionauth_client.rb', line 1440

def retrieve_applications()
  start.uri('/api/application')
      .get()
      .go()
end

#retrieve_audit_log(audit_log_id) ⇒ FusionAuth::ClientResponse

Retrieves a single audit log for the given Id.

Parameters:

  • audit_log_id (Numeric)

    The Id of the audit log to retrieve.

Returns:



1451
1452
1453
1454
1455
1456
# File 'lib/fusionauth/fusionauth_client.rb', line 1451

def retrieve_audit_log(audit_log_id)
  start.uri('/api/system/audit-log')
      .url_segment(audit_log_id)
      .get()
      .go()
end

Retrieves the Consent for the given Id.

Parameters:

  • consent_id (string)

    The Id of the consent.

Returns:



1463
1464
1465
1466
1467
1468
# File 'lib/fusionauth/fusionauth_client.rb', line 1463

def retrieve_consent(consent_id)
  start.uri('/api/consent')
      .url_segment(consent_id)
      .get()
      .go()
end

#retrieve_consentsFusionAuth::ClientResponse

Retrieves all of the consent.

Returns:



1474
1475
1476
1477
1478
# File 'lib/fusionauth/fusionauth_client.rb', line 1474

def retrieve_consents()
  start.uri('/api/consent')
      .get()
      .go()
end

#retrieve_daily_active_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the daily active user report between the two instants. If you specify an application id, it will only return the daily active counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1488
1489
1490
1491
1492
1493
1494
1495
# File 'lib/fusionauth/fusionauth_client.rb', line 1488

def retrieve_daily_active_report(application_id, start, _end)
  start.uri('/api/report/daily-active-user')
      .url_parameter('applicationId', application_id)
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_email_template(email_template_id) ⇒ FusionAuth::ClientResponse

Retrieves the email template for the given Id. If you don’t specify the id, this will return all of the email templates.

Parameters:

  • email_template_id (string)

    (Optional) The Id of the email template.

Returns:



1502
1503
1504
1505
1506
1507
# File 'lib/fusionauth/fusionauth_client.rb', line 1502

def retrieve_email_template(email_template_id)
  start.uri('/api/email/template')
      .url_segment(email_template_id)
      .get()
      .go()
end

#retrieve_email_template_preview(request) ⇒ FusionAuth::ClientResponse

Creates a preview of the email template provided in the request. This allows you to preview an email template that hasn’t been saved to the database yet. The entire email template does not need to be provided on the request. This will create the preview based on whatever is given.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains the email template and optionally a locale to render it in.

Returns:



1516
1517
1518
1519
1520
1521
# File 'lib/fusionauth/fusionauth_client.rb', line 1516

def retrieve_email_template_preview(request)
  start.uri('/api/email/template/preview')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#retrieve_email_templatesFusionAuth::ClientResponse

Retrieves all of the email templates.

Returns:



1527
1528
1529
1530
1531
# File 'lib/fusionauth/fusionauth_client.rb', line 1527

def retrieve_email_templates()
  start.uri('/api/email/template')
      .get()
      .go()
end

#retrieve_event_log(event_log_id) ⇒ FusionAuth::ClientResponse

Retrieves a single event log for the given Id.

Parameters:

  • event_log_id (Numeric)

    The Id of the event log to retrieve.

Returns:



1538
1539
1540
1541
1542
1543
# File 'lib/fusionauth/fusionauth_client.rb', line 1538

def retrieve_event_log(event_log_id)
  start.uri('/api/system/event-log')
      .url_segment(event_log_id)
      .get()
      .go()
end

#retrieve_families(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the families that a user belongs to.

Parameters:

  • user_id (string)

    The User’s id

Returns:



1550
1551
1552
1553
1554
1555
# File 'lib/fusionauth/fusionauth_client.rb', line 1550

def retrieve_families(user_id)
  start.uri('/api/user/family')
      .url_parameter('userId', user_id)
      .get()
      .go()
end

#retrieve_family_members_by_family_id(family_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the members of a family by the unique Family Id.

Parameters:

  • family_id (string)

    The unique Id of the Family.

Returns:



1562
1563
1564
1565
1566
1567
# File 'lib/fusionauth/fusionauth_client.rb', line 1562

def retrieve_family_members_by_family_id(family_id)
  start.uri('/api/user/family')
      .url_segment(family_id)
      .get()
      .go()
end

#retrieve_group(group_id) ⇒ FusionAuth::ClientResponse

Retrieves the group for the given Id.

Parameters:

  • group_id (string)

    The Id of the group.

Returns:



1574
1575
1576
1577
1578
1579
# File 'lib/fusionauth/fusionauth_client.rb', line 1574

def retrieve_group(group_id)
  start.uri('/api/group')
      .url_segment(group_id)
      .get()
      .go()
end

#retrieve_groupsFusionAuth::ClientResponse

Retrieves all of the groups.

Returns:



1585
1586
1587
1588
1589
# File 'lib/fusionauth/fusionauth_client.rb', line 1585

def retrieve_groups()
  start.uri('/api/group')
      .get()
      .go()
end

#retrieve_identity_provider(identity_provider_id) ⇒ FusionAuth::ClientResponse

Retrieves the identity provider for the given id or all of the identity providers if the id is null.

Parameters:

  • identity_provider_id (string)

    (Optional) The identity provider id.

Returns:



1596
1597
1598
1599
1600
1601
# File 'lib/fusionauth/fusionauth_client.rb', line 1596

def retrieve_identity_provider(identity_provider_id)
  start.uri('/api/identity-provider')
      .url_segment(identity_provider_id)
      .get()
      .go()
end

#retrieve_identity_providersFusionAuth::ClientResponse

Retrieves all of the identity providers.

Returns:



1607
1608
1609
1610
1611
# File 'lib/fusionauth/fusionauth_client.rb', line 1607

def retrieve_identity_providers()
  start.uri('/api/identity-provider')
      .get()
      .go()
end

#retrieve_inactive_actions(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the actions for the user with the given Id that are currently inactive. An inactive action means one that is time based and has been canceled or has expired, or is not time based.

Parameters:

  • user_id (string)

    The Id of the user to fetch the actions for.

Returns:



1619
1620
1621
1622
1623
1624
1625
# File 'lib/fusionauth/fusionauth_client.rb', line 1619

def retrieve_inactive_actions(user_id)
  start.uri('/api/user/action')
      .url_parameter('userId', user_id)
      .url_parameter('active', false)
      .get()
      .go()
end

#retrieve_inactive_applicationsFusionAuth::ClientResponse

Retrieves all of the applications that are currently inactive.

Returns:



1631
1632
1633
1634
1635
1636
# File 'lib/fusionauth/fusionauth_client.rb', line 1631

def retrieve_inactive_applications()
  start.uri('/api/application')
      .url_parameter('inactive', true)
      .get()
      .go()
end

#retrieve_inactive_user_actionsFusionAuth::ClientResponse

Retrieves all of the user actions that are currently inactive.

Returns:



1642
1643
1644
1645
1646
1647
# File 'lib/fusionauth/fusionauth_client.rb', line 1642

def ()
  start.uri('/api/user-action')
      .url_parameter('inactive', true)
      .get()
      .go()
end

#retrieve_integrationFusionAuth::ClientResponse

Retrieves the available integrations.

Returns:



1653
1654
1655
1656
1657
# File 'lib/fusionauth/fusionauth_client.rb', line 1653

def retrieve_integration()
  start.uri('/api/integration')
      .get()
      .go()
end

#retrieve_json_web_key_setFusionAuth::ClientResponse

Returns public keys used by FusionAuth to cryptographically verify JWTs using the JSON Web Key format.

Returns:



1697
1698
1699
1700
1701
# File 'lib/fusionauth/fusionauth_client.rb', line 1697

def retrieve_json_web_key_set()
  startAnonymous.uri('/.well-known/jwks.json')
      .get()
      .go()
end

#retrieve_jwt_public_key(key_id) ⇒ FusionAuth::ClientResponse

Retrieves the Public Key configured for verifying JSON Web Tokens (JWT) by the key Id (kid).

Parameters:

  • key_id (string)

    The Id of the public key (kid).

Returns:



1664
1665
1666
1667
1668
1669
# File 'lib/fusionauth/fusionauth_client.rb', line 1664

def retrieve_jwt_public_key(key_id)
  startAnonymous.uri('/api/jwt/public-key')
      .url_parameter('kid', key_id)
      .get()
      .go()
end

#retrieve_jwt_public_key_by_application_id(application_id) ⇒ FusionAuth::ClientResponse

Retrieves the Public Key configured for verifying the JSON Web Tokens (JWT) issued by the Login API by the Application Id.

Parameters:

  • application_id (string)

    The Id of the Application for which this key is used.

Returns:



1676
1677
1678
1679
1680
1681
# File 'lib/fusionauth/fusionauth_client.rb', line 1676

def retrieve_jwt_public_key_by_application_id(application_id)
  startAnonymous.uri('/api/jwt/public-key')
      .url_parameter('applicationId', application_id)
      .get()
      .go()
end

#retrieve_jwt_public_keysFusionAuth::ClientResponse

Retrieves all Public Keys configured for verifying JSON Web Tokens (JWT).

Returns:



1687
1688
1689
1690
1691
# File 'lib/fusionauth/fusionauth_client.rb', line 1687

def retrieve_jwt_public_keys()
  startAnonymous.uri('/api/jwt/public-key')
      .get()
      .go()
end

#retrieve_key(key_id) ⇒ FusionAuth::ClientResponse

Retrieves the key for the given Id.

Parameters:

  • key_id (string)

    The Id of the key.

Returns:



1708
1709
1710
1711
1712
1713
# File 'lib/fusionauth/fusionauth_client.rb', line 1708

def retrieve_key(key_id)
  start.uri('/api/key')
      .url_segment(key_id)
      .get()
      .go()
end

#retrieve_keysFusionAuth::ClientResponse

Retrieves all of the keys.

Returns:



1719
1720
1721
1722
1723
# File 'lib/fusionauth/fusionauth_client.rb', line 1719

def retrieve_keys()
  start.uri('/api/key')
      .get()
      .go()
end

#retrieve_lambda(lambda_id) ⇒ FusionAuth::ClientResponse

Retrieves the lambda for the given Id.

Parameters:

  • lambda_id (string)

    The Id of the lambda.

Returns:



1730
1731
1732
1733
1734
1735
# File 'lib/fusionauth/fusionauth_client.rb', line 1730

def retrieve_lambda(lambda_id)
  start.uri('/api/lambda')
      .url_segment(lambda_id)
      .get()
      .go()
end

#retrieve_lambdasFusionAuth::ClientResponse

Retrieves all of the lambdas.

Returns:



1741
1742
1743
1744
1745
# File 'lib/fusionauth/fusionauth_client.rb', line 1741

def retrieve_lambdas()
  start.uri('/api/lambda')
      .get()
      .go()
end

#retrieve_lambdas_by_type(type) ⇒ FusionAuth::ClientResponse

Retrieves all of the lambdas for the provided type.

Parameters:

  • type (OpenStruct, Hash)

    The type of the lambda to return.

Returns:



1752
1753
1754
1755
1756
1757
# File 'lib/fusionauth/fusionauth_client.rb', line 1752

def retrieve_lambdas_by_type(type)
  start.uri('/api/lambda')
      .url_parameter('type', type)
      .get()
      .go()
end

#retrieve_login_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the login report between the two instants. If you specify an application id, it will only return the login counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/fusionauth/fusionauth_client.rb', line 1767

def (application_id, start, _end)
  start.uri('/api/report/login')
      .url_parameter('applicationId', application_id)
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_monthly_active_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the monthly active user report between the two instants. If you specify an application id, it will only return the monthly active counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1784
1785
1786
1787
1788
1789
1790
1791
# File 'lib/fusionauth/fusionauth_client.rb', line 1784

def retrieve_monthly_active_report(application_id, start, _end)
  start.uri('/api/report/monthly-active-user')
      .url_parameter('applicationId', application_id)
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_oauth_configuration(application_id) ⇒ FusionAuth::ClientResponse

Retrieves the Oauth2 configuration for the application for the given Application Id.

Parameters:

  • application_id (string)

    The Id of the Application to retrieve OAuth configuration.

Returns:



1798
1799
1800
1801
1802
1803
1804
# File 'lib/fusionauth/fusionauth_client.rb', line 1798

def retrieve_oauth_configuration(application_id)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_segment("oauth-configuration")
      .get()
      .go()
end

#retrieve_open_id_configurationFusionAuth::ClientResponse

Returns the well known OpenID Configuration JSON document

Returns:



1810
1811
1812
1813
1814
# File 'lib/fusionauth/fusionauth_client.rb', line 1810

def retrieve_open_id_configuration()
  startAnonymous.uri('/.well-known/openid-configuration')
      .get()
      .go()
end

#retrieve_password_validation_rulesFusionAuth::ClientResponse

Retrieves the password validation rules for a specific tenant. This method requires a tenantId to be provided through the use of a Tenant scoped API key or an HTTP header X-FusionAuth-TenantId to specify the Tenant Id.

This API does not require an API key.

Returns:



1823
1824
1825
1826
1827
# File 'lib/fusionauth/fusionauth_client.rb', line 1823

def retrieve_password_validation_rules()
  startAnonymous.uri('/api/tenant/password-validation-rules')
      .get()
      .go()
end

#retrieve_password_validation_rules_with_tenant_id(tenant_id) ⇒ FusionAuth::ClientResponse

Retrieves the password validation rules for a specific tenant.

This API does not require an API key.

Parameters:

  • tenant_id (string)

    The Id of the tenant.

Returns:



1836
1837
1838
1839
1840
1841
# File 'lib/fusionauth/fusionauth_client.rb', line 1836

def retrieve_password_validation_rules_with_tenant_id(tenant_id)
  startAnonymous.uri('/api/tenant/password-validation-rules')
      .url_segment(tenant_id)
      .get()
      .go()
end

#retrieve_pending_children(parent_email) ⇒ FusionAuth::ClientResponse

Retrieves all of the children for the given parent email address.

Parameters:

  • parent_email (string)

    The email of the parent.

Returns:



1848
1849
1850
1851
1852
1853
# File 'lib/fusionauth/fusionauth_client.rb', line 1848

def retrieve_pending_children(parent_email)
  start.uri('/api/user/family/pending')
      .url_parameter('parentEmail', parent_email)
      .get()
      .go()
end

#retrieve_recent_logins(offset, limit) ⇒ FusionAuth::ClientResponse

Retrieves the last number of login records.

Parameters:

  • offset (Numeric)

    The initial record. e.g. 0 is the last login, 100 will be the 100th most recent login.

  • limit (Numeric)

    (Optional, defaults to 10) The number of records to retrieve.

Returns:



1861
1862
1863
1864
1865
1866
1867
# File 'lib/fusionauth/fusionauth_client.rb', line 1861

def retrieve_recent_logins(offset, limit)
  start.uri('/api/user/recent-login')
      .url_parameter('offset', offset)
      .url_parameter('limit', limit)
      .get()
      .go()
end

#retrieve_refresh_tokens(user_id) ⇒ FusionAuth::ClientResponse

Retrieves the refresh tokens that belong to the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



1874
1875
1876
1877
1878
1879
# File 'lib/fusionauth/fusionauth_client.rb', line 1874

def retrieve_refresh_tokens(user_id)
  start.uri('/api/jwt/refresh')
      .url_parameter('userId', user_id)
      .get()
      .go()
end

#retrieve_registration(user_id, application_id) ⇒ FusionAuth::ClientResponse

Retrieves the user registration for the user with the given id and the given application id.

Parameters:

  • user_id (string)

    The Id of the user.

  • application_id (string)

    The Id of the application.

Returns:



1887
1888
1889
1890
1891
1892
1893
# File 'lib/fusionauth/fusionauth_client.rb', line 1887

def retrieve_registration(user_id, application_id)
  start.uri('/api/user/registration')
      .url_segment(user_id)
      .url_segment(application_id)
      .get()
      .go()
end

#retrieve_registration_report(application_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the registration report between the two instants. If you specify an application id, it will only return the registration counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



1903
1904
1905
1906
1907
1908
1909
1910
# File 'lib/fusionauth/fusionauth_client.rb', line 1903

def retrieve_registration_report(application_id, start, _end)
  start.uri('/api/report/registration')
      .url_parameter('applicationId', application_id)
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_system_configurationFusionAuth::ClientResponse

Retrieves the system configuration.

Returns:



1916
1917
1918
1919
1920
# File 'lib/fusionauth/fusionauth_client.rb', line 1916

def retrieve_system_configuration()
  start.uri('/api/system-configuration')
      .get()
      .go()
end

#retrieve_tenant(tenant_id) ⇒ FusionAuth::ClientResponse

Retrieves the tenant for the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant.

Returns:



1927
1928
1929
1930
1931
1932
# File 'lib/fusionauth/fusionauth_client.rb', line 1927

def retrieve_tenant(tenant_id)
  start.uri('/api/tenant')
      .url_segment(tenant_id)
      .get()
      .go()
end

#retrieve_tenantsFusionAuth::ClientResponse

Retrieves all of the tenants.

Returns:



1938
1939
1940
1941
1942
# File 'lib/fusionauth/fusionauth_client.rb', line 1938

def retrieve_tenants()
  start.uri('/api/tenant')
      .get()
      .go()
end

#retrieve_theme(theme_id) ⇒ FusionAuth::ClientResponse

Retrieves the theme for the given Id.

Parameters:

  • theme_id (string)

    The Id of the theme.

Returns:



1949
1950
1951
1952
1953
1954
# File 'lib/fusionauth/fusionauth_client.rb', line 1949

def retrieve_theme(theme_id)
  start.uri('/api/theme')
      .url_segment(theme_id)
      .get()
      .go()
end

#retrieve_themesFusionAuth::ClientResponse

Retrieves all of the themes.

Returns:



1960
1961
1962
1963
1964
# File 'lib/fusionauth/fusionauth_client.rb', line 1960

def retrieve_themes()
  start.uri('/api/theme')
      .get()
      .go()
end

#retrieve_total_reportFusionAuth::ClientResponse

Retrieves the totals report. This contains all of the total counts for each application and the global registration count.

Returns:



1971
1972
1973
1974
1975
# File 'lib/fusionauth/fusionauth_client.rb', line 1971

def retrieve_total_report()
  start.uri('/api/report/totals')
      .get()
      .go()
end

#retrieve_user(user_id) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



1982
1983
1984
1985
1986
1987
# File 'lib/fusionauth/fusionauth_client.rb', line 1982

def retrieve_user(user_id)
  start.uri('/api/user')
      .url_segment(user_id)
      .get()
      .go()
end

#retrieve_user_action(user_action_id) ⇒ FusionAuth::ClientResponse

Retrieves the user action for the given Id. If you pass in null for the id, this will return all of the user actions.

Parameters:

  • user_action_id (string)

    (Optional) The Id of the user action.

Returns:



1995
1996
1997
1998
1999
2000
# File 'lib/fusionauth/fusionauth_client.rb', line 1995

def retrieve_user_action(user_action_id)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .get()
      .go()
end

#retrieve_user_action_reason(user_action_reason_id) ⇒ FusionAuth::ClientResponse

Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all of the user action reasons.

Parameters:

  • user_action_reason_id (string)

    (Optional) The Id of the user action reason.

Returns:



2008
2009
2010
2011
2012
2013
# File 'lib/fusionauth/fusionauth_client.rb', line 2008

def retrieve_user_action_reason(user_action_reason_id)
  start.uri('/api/user-action-reason')
      .url_segment(user_action_reason_id)
      .get()
      .go()
end

#retrieve_user_action_reasonsFusionAuth::ClientResponse

Retrieves all the user action reasons.

Returns:



2019
2020
2021
2022
2023
# File 'lib/fusionauth/fusionauth_client.rb', line 2019

def retrieve_user_action_reasons()
  start.uri('/api/user-action-reason')
      .get()
      .go()
end

#retrieve_user_actionsFusionAuth::ClientResponse

Retrieves all of the user actions.

Returns:



2029
2030
2031
2032
2033
# File 'lib/fusionauth/fusionauth_client.rb', line 2029

def ()
  start.uri('/api/user-action')
      .get()
      .go()
end

#retrieve_user_by_change_password_id(change_password_id) ⇒ FusionAuth::ClientResponse

Retrieves the user by a change password Id. The intended use of this API is to retrieve a user after the forgot password workflow has been initiated and you may not know the user’s email or username.

Parameters:

  • change_password_id (string)

    The unique change password Id that was sent via email or returned by the Forgot Password API.

Returns:



2041
2042
2043
2044
2045
2046
# File 'lib/fusionauth/fusionauth_client.rb', line 2041

def retrieve_user_by_change_password_id(change_password_id)
  start.uri('/api/user')
      .url_parameter('changePasswordId', change_password_id)
      .get()
      .go()
end

#retrieve_user_by_email(email) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given email.

Parameters:

  • email (string)

    The email of the user.

Returns:



2053
2054
2055
2056
2057
2058
# File 'lib/fusionauth/fusionauth_client.rb', line 2053

def retrieve_user_by_email(email)
  start.uri('/api/user')
      .url_parameter('email', email)
      .get()
      .go()
end

#retrieve_user_by_login_id(login_id) ⇒ FusionAuth::ClientResponse

Retrieves the user for the loginId. The loginId can be either the username or the email.

Parameters:

  • login_id (string)

    The email or username of the user.

Returns:



2065
2066
2067
2068
2069
2070
# File 'lib/fusionauth/fusionauth_client.rb', line 2065

def ()
  start.uri('/api/user')
      .url_parameter('loginId', )
      .get()
      .go()
end

#retrieve_user_by_username(username) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given username.

Parameters:

  • username (string)

    The username of the user.

Returns:



2077
2078
2079
2080
2081
2082
# File 'lib/fusionauth/fusionauth_client.rb', line 2077

def retrieve_user_by_username(username)
  start.uri('/api/user')
      .url_parameter('username', username)
      .get()
      .go()
end

#retrieve_user_by_verification_id(verification_id) ⇒ FusionAuth::ClientResponse

Retrieves the user by a verificationId. The intended use of this API is to retrieve a user after the forgot password workflow has been initiated and you may not know the user’s email or username.

Parameters:

  • verification_id (string)

    The unique verification Id that has been set on the user object.

Returns:



2090
2091
2092
2093
2094
2095
# File 'lib/fusionauth/fusionauth_client.rb', line 2090

def retrieve_user_by_verification_id(verification_id)
  start.uri('/api/user')
      .url_parameter('verificationId', verification_id)
      .get()
      .go()
end

#retrieve_user_comments(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the comments for the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user.

Returns:



2102
2103
2104
2105
2106
2107
# File 'lib/fusionauth/fusionauth_client.rb', line 2102

def retrieve_user_comments(user_id)
  start.uri('/api/user/comment')
      .url_segment(user_id)
      .get()
      .go()
end

Retrieve a single User consent by Id.

Parameters:

  • user_consent_id (string)

    The User consent Id

Returns:



2114
2115
2116
2117
2118
2119
# File 'lib/fusionauth/fusionauth_client.rb', line 2114

def retrieve_user_consent(user_consent_id)
  start.uri('/api/user/consent')
      .url_segment(user_consent_id)
      .get()
      .go()
end

#retrieve_user_consents(user_id) ⇒ FusionAuth::ClientResponse

Retrieves all of the consents for a User.

Parameters:

  • user_id (string)

    The User’s Id

Returns:



2126
2127
2128
2129
2130
2131
# File 'lib/fusionauth/fusionauth_client.rb', line 2126

def retrieve_user_consents(user_id)
  start.uri('/api/user/consent')
      .url_parameter('userId', user_id)
      .get()
      .go()
end

#retrieve_user_login_report(application_id, user_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the login counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • user_id (string)

    The userId id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



2142
2143
2144
2145
2146
2147
2148
2149
2150
# File 'lib/fusionauth/fusionauth_client.rb', line 2142

def (application_id, user_id, start, _end)
  start.uri('/api/report/login')
      .url_parameter('applicationId', application_id)
      .url_parameter('userId', user_id)
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_user_login_report_by_login_id(application_id, login_id, start, _end) ⇒ FusionAuth::ClientResponse

Retrieves the login report between the two instants for a particular user by login Id. If you specify an application id, it will only return the login counts for that application.

Parameters:

  • application_id (string)

    (Optional) The application id.

  • login_id (string)

    The userId id.

  • start (OpenStruct, Hash)

    The start instant as UTC milliseconds since Epoch.

  • _end (OpenStruct, Hash)

    The end instant as UTC milliseconds since Epoch.

Returns:



2161
2162
2163
2164
2165
2166
2167
2168
2169
# File 'lib/fusionauth/fusionauth_client.rb', line 2161

def (application_id, , start, _end)
  start.uri('/api/report/login')
      .url_parameter('applicationId', application_id)
      .url_parameter('loginId', )
      .url_parameter('start', start)
      .url_parameter('end', _end)
      .get()
      .go()
end

#retrieve_user_recent_logins(user_id, offset, limit) ⇒ FusionAuth::ClientResponse

Retrieves the last number of login records for a user.

Parameters:

  • user_id (string)

    The Id of the user.

  • offset (Numeric)

    The initial record. e.g. 0 is the last login, 100 will be the 100th most recent login.

  • limit (Numeric)

    (Optional, defaults to 10) The number of records to retrieve.

Returns:



2178
2179
2180
2181
2182
2183
2184
2185
# File 'lib/fusionauth/fusionauth_client.rb', line 2178

def retrieve_user_recent_logins(user_id, offset, limit)
  start.uri('/api/user/recent-login')
      .url_parameter('userId', user_id)
      .url_parameter('offset', offset)
      .url_parameter('limit', limit)
      .get()
      .go()
end

#retrieve_user_using_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Retrieves the user for the given Id. This method does not use an API key, instead it uses a JSON Web Token (JWT) for authentication.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



2192
2193
2194
2195
2196
2197
# File 'lib/fusionauth/fusionauth_client.rb', line 2192

def retrieve_user_using_jwt(encoded_jwt)
  startAnonymous.uri('/api/user')
      .authorization('JWT ' + encoded_jwt)
      .get()
      .go()
end

#retrieve_webhook(webhook_id) ⇒ FusionAuth::ClientResponse

Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks.

Parameters:

  • webhook_id (string)

    (Optional) The Id of the webhook.

Returns:



2204
2205
2206
2207
2208
2209
# File 'lib/fusionauth/fusionauth_client.rb', line 2204

def retrieve_webhook(webhook_id)
  start.uri('/api/webhook')
      .url_segment(webhook_id)
      .get()
      .go()
end

#retrieve_webhooksFusionAuth::ClientResponse

Retrieves all the webhooks.

Returns:



2215
2216
2217
2218
2219
# File 'lib/fusionauth/fusionauth_client.rb', line 2215

def retrieve_webhooks()
  start.uri('/api/webhook')
      .get()
      .go()
end

#revoke_refresh_token(token, user_id, application_id) ⇒ FusionAuth::ClientResponse

Revokes a single refresh token, all tokens for a user or all tokens for an application. If you provide a user id and an application id, this will delete all the refresh tokens for that user for that application.

Parameters:

  • token (string)

    (Optional) The refresh token to delete.

  • user_id (string)

    (Optional) The user id whose tokens to delete.

  • application_id (string)

    (Optional) The application id of the tokens to delete.

Returns:



2229
2230
2231
2232
2233
2234
2235
2236
# File 'lib/fusionauth/fusionauth_client.rb', line 2229

def revoke_refresh_token(token, user_id, application_id)
  start.uri('/api/jwt/refresh')
      .url_parameter('token', token)
      .url_parameter('userId', user_id)
      .url_parameter('applicationId', application_id)
      .delete()
      .go()
end

Revokes a single User consent by Id.

Parameters:

  • user_consent_id (string)

    The User Consent Id

Returns:



2243
2244
2245
2246
2247
2248
# File 'lib/fusionauth/fusionauth_client.rb', line 2243

def revoke_user_consent(user_consent_id)
  start.uri('/api/user/consent')
      .url_segment(user_consent_id)
      .delete()
      .go()
end

#search_audit_logs(request) ⇒ FusionAuth::ClientResponse

Searches the audit logs with the specified criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination information.

Returns:



2255
2256
2257
2258
2259
2260
# File 'lib/fusionauth/fusionauth_client.rb', line 2255

def search_audit_logs(request)
  start.uri('/api/system/audit-log/search')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#search_event_logs(request) ⇒ FusionAuth::ClientResponse

Searches the event logs with the specified criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination information.

Returns:



2267
2268
2269
2270
2271
2272
# File 'lib/fusionauth/fusionauth_client.rb', line 2267

def search_event_logs(request)
  start.uri('/api/system/event-log/search')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#search_login_records(request) ⇒ FusionAuth::ClientResponse

Searches the login records with the specified criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination information.

Returns:



2279
2280
2281
2282
2283
2284
# File 'lib/fusionauth/fusionauth_client.rb', line 2279

def (request)
  start.uri('/api/system/login-record/search')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#search_users(ids) ⇒ FusionAuth::ClientResponse

Deprecated.

This method has been renamed to search_users_by_ids, use that method instead.

Retrieves the users for the given ids. If any id is invalid, it is ignored.

Parameters:

  • ids (Array)

    The user ids to search for.

Returns:



2292
2293
2294
2295
2296
2297
# File 'lib/fusionauth/fusionauth_client.rb', line 2292

def search_users(ids)
  start.uri('/api/user/search')
      .url_parameter('ids', ids)
      .get()
      .go()
end

#search_users_by_ids(ids) ⇒ FusionAuth::ClientResponse

Retrieves the users for the given ids. If any id is invalid, it is ignored.

Parameters:

  • ids (Array)

    The user ids to search for.

Returns:



2304
2305
2306
2307
2308
2309
# File 'lib/fusionauth/fusionauth_client.rb', line 2304

def search_users_by_ids(ids)
  start.uri('/api/user/search')
      .url_parameter('ids', ids)
      .get()
      .go()
end

#search_users_by_query(request) ⇒ FusionAuth::ClientResponse

Retrieves the users for the given search criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination constraints. Fields used: ids, query, queryString, numberOfResults, orderBy, startRow, and sortFields.

Returns:



2317
2318
2319
2320
2321
2322
# File 'lib/fusionauth/fusionauth_client.rb', line 2317

def search_users_by_query(request)
  start.uri('/api/user/search')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#search_users_by_query_string(request) ⇒ FusionAuth::ClientResponse

Deprecated.

This method has been renamed to search_users_by_query, use that method instead.

Retrieves the users for the given search criteria and pagination.

Parameters:

  • request (OpenStruct, Hash)

    The search criteria and pagination constraints. Fields used: ids, query, queryString, numberOfResults, orderBy, startRow, and sortFields.

Returns:



2331
2332
2333
2334
2335
2336
# File 'lib/fusionauth/fusionauth_client.rb', line 2331

def search_users_by_query_string(request)
  start.uri('/api/user/search')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#send_email(email_template_id, request) ⇒ FusionAuth::ClientResponse

Send an email using an email template id. You can optionally provide requestData to access key value pairs in the email template.

Parameters:

  • email_template_id (string)

    The id for the template.

  • request (OpenStruct, Hash)

    The send email request that contains all of the information used to send the email.

Returns:



2345
2346
2347
2348
2349
2350
2351
# File 'lib/fusionauth/fusionauth_client.rb', line 2345

def send_email(email_template_id, request)
  start.uri('/api/email/send')
      .url_segment(email_template_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#send_family_request_email(request) ⇒ FusionAuth::ClientResponse

Sends out an email to a parent that they need to register and create a family or need to log in and add a child to their existing family.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains the parent email.

Returns:



2358
2359
2360
2361
2362
2363
# File 'lib/fusionauth/fusionauth_client.rb', line 2358

def send_family_request_email(request)
  start.uri('/api/user/family/request')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#send_passwordless_code(request) ⇒ FusionAuth::ClientResponse

Send a passwordless authentication code in an email to complete login.

Parameters:

  • request (OpenStruct, Hash)

    The passwordless send request that contains all of the information used to send an email containing a code.

Returns:



2370
2371
2372
2373
2374
2375
# File 'lib/fusionauth/fusionauth_client.rb', line 2370

def send_passwordless_code(request)
  startAnonymous.uri('/api/passwordless/send')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#send_two_factor_code(request) ⇒ FusionAuth::ClientResponse

Send a Two Factor authentication code to assist in setting up Two Factor authentication or disabling.

Parameters:

  • request (OpenStruct, Hash)

    The request object that contains all of the information used to send the code.

Returns:



2382
2383
2384
2385
2386
2387
# File 'lib/fusionauth/fusionauth_client.rb', line 2382

def send_two_factor_code(request)
  start.uri('/api/two-factor/send')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#send_two_factor_code_for_login(two_factor_id) ⇒ FusionAuth::ClientResponse

Send a Two Factor authentication code to allow the completion of Two Factor authentication.

Parameters:

  • two_factor_id (string)

    The Id returned by the Login API necessary to complete Two Factor authentication.

Returns:



2394
2395
2396
2397
2398
2399
# File 'lib/fusionauth/fusionauth_client.rb', line 2394

def (two_factor_id)
  startAnonymous.uri('/api/two-factor/send')
      .url_segment(two_factor_id)
      .post()
      .go()
end

#set_tenant_id(tenant_id) ⇒ Object



40
41
42
# File 'lib/fusionauth/fusionauth_client.rb', line 40

def set_tenant_id(tenant_id)
  @tenant_id = tenant_id
end

#start_identity_provider_login(request) ⇒ FusionAuth::ClientResponse

Begins a login request for a 3rd party login that requires user interaction such as HYPR.

Parameters:

  • request (OpenStruct, Hash)

    The third-party login request that contains information from the third-party login providers that FusionAuth uses to reconcile the user’s account.

Returns:



2407
2408
2409
2410
2411
2412
# File 'lib/fusionauth/fusionauth_client.rb', line 2407

def (request)
  start.uri('/api/identity-provider/start')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#start_passwordless_login(request) ⇒ FusionAuth::ClientResponse

Start a passwordless login request by generating a passwordless code. This code can be sent to the User using the Send Passwordless Code API or using a mechanism outside of FusionAuth. The passwordless login is completed by using the Passwordless Login API with this code.

Parameters:

  • request (OpenStruct, Hash)

    The passwordless start request that contains all of the information used to begin the passwordless login request.

Returns:



2420
2421
2422
2423
2424
2425
# File 'lib/fusionauth/fusionauth_client.rb', line 2420

def (request)
  start.uri('/api/passwordless/start')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#two_factor_login(request) ⇒ FusionAuth::ClientResponse

Complete login using a 2FA challenge

Parameters:

  • request (OpenStruct, Hash)

    The login request that contains the user credentials used to log them in.

Returns:



2432
2433
2434
2435
2436
2437
# File 'lib/fusionauth/fusionauth_client.rb', line 2432

def (request)
  startAnonymous.uri('/api/two-factor/login')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .post()
      .go()
end

#update_application(application_id, request) ⇒ FusionAuth::ClientResponse

Updates the application with the given Id.

Parameters:

  • application_id (string)

    The Id of the application to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new application information.

Returns:



2445
2446
2447
2448
2449
2450
2451
# File 'lib/fusionauth/fusionauth_client.rb', line 2445

def update_application(application_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_application_role(application_id, role_id, request) ⇒ FusionAuth::ClientResponse

Updates the application role with the given id for the application.

Parameters:

  • application_id (string)

    The Id of the application that the role belongs to.

  • role_id (string)

    The Id of the role to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new role information.

Returns:



2460
2461
2462
2463
2464
2465
2466
2467
2468
# File 'lib/fusionauth/fusionauth_client.rb', line 2460

def update_application_role(application_id, role_id, request)
  start.uri('/api/application')
      .url_segment(application_id)
      .url_segment("role")
      .url_segment(role_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

Updates the consent with the given Id.

Parameters:

  • consent_id (string)

    The Id of the consent to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new consent information.

Returns:



2476
2477
2478
2479
2480
2481
2482
# File 'lib/fusionauth/fusionauth_client.rb', line 2476

def update_consent(consent_id, request)
  start.uri('/api/consent')
      .url_segment(consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_email_template(email_template_id, request) ⇒ FusionAuth::ClientResponse

Updates the email template with the given Id.

Parameters:

  • email_template_id (string)

    The Id of the email template to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new email template information.

Returns:



2490
2491
2492
2493
2494
2495
2496
# File 'lib/fusionauth/fusionauth_client.rb', line 2490

def update_email_template(email_template_id, request)
  start.uri('/api/email/template')
      .url_segment(email_template_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_group(group_id, request) ⇒ FusionAuth::ClientResponse

Updates the group with the given Id.

Parameters:

  • group_id (string)

    The Id of the group to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new group information.

Returns:



2504
2505
2506
2507
2508
2509
2510
# File 'lib/fusionauth/fusionauth_client.rb', line 2504

def update_group(group_id, request)
  start.uri('/api/group')
      .url_segment(group_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_identity_provider(identity_provider_id, request) ⇒ FusionAuth::ClientResponse

Updates the identity provider with the given Id.

Parameters:

  • identity_provider_id (string)

    The Id of the identity provider to update.

  • request (OpenStruct, Hash)

    The request object that contains the updated identity provider.

Returns:



2518
2519
2520
2521
2522
2523
2524
# File 'lib/fusionauth/fusionauth_client.rb', line 2518

def update_identity_provider(identity_provider_id, request)
  start.uri('/api/identity-provider')
      .url_segment(identity_provider_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_integrations(request) ⇒ FusionAuth::ClientResponse

Updates the available integrations.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the new integration information.

Returns:



2531
2532
2533
2534
2535
2536
# File 'lib/fusionauth/fusionauth_client.rb', line 2531

def update_integrations(request)
  start.uri('/api/integration')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_key(key_id, request) ⇒ FusionAuth::ClientResponse

Updates the key with the given Id.

Parameters:

  • key_id (string)

    The Id of the key to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new key information.

Returns:



2544
2545
2546
2547
2548
2549
2550
# File 'lib/fusionauth/fusionauth_client.rb', line 2544

def update_key(key_id, request)
  start.uri('/api/key')
      .url_segment(key_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_lambda(lambda_id, request) ⇒ FusionAuth::ClientResponse

Updates the lambda with the given Id.

Parameters:

  • lambda_id (string)

    The Id of the lambda to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new lambda information.

Returns:



2558
2559
2560
2561
2562
2563
2564
# File 'lib/fusionauth/fusionauth_client.rb', line 2558

def update_lambda(lambda_id, request)
  start.uri('/api/lambda')
      .url_segment(lambda_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_registration(user_id, request) ⇒ FusionAuth::ClientResponse

Updates the registration for the user with the given id and the application defined in the request.

Parameters:

  • user_id (string)

    The Id of the user whose registration is going to be updated.

  • request (OpenStruct, Hash)

    The request that contains all of the new registration information.

Returns:



2572
2573
2574
2575
2576
2577
2578
# File 'lib/fusionauth/fusionauth_client.rb', line 2572

def update_registration(user_id, request)
  start.uri('/api/user/registration')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_system_configuration(request) ⇒ FusionAuth::ClientResponse

Updates the system configuration.

Parameters:

  • request (OpenStruct, Hash)

    The request that contains all of the new system configuration information.

Returns:



2585
2586
2587
2588
2589
2590
# File 'lib/fusionauth/fusionauth_client.rb', line 2585

def update_system_configuration(request)
  start.uri('/api/system-configuration')
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_tenant(tenant_id, request) ⇒ FusionAuth::ClientResponse

Updates the tenant with the given Id.

Parameters:

  • tenant_id (string)

    The Id of the tenant to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new tenant information.

Returns:



2598
2599
2600
2601
2602
2603
2604
# File 'lib/fusionauth/fusionauth_client.rb', line 2598

def update_tenant(tenant_id, request)
  start.uri('/api/tenant')
      .url_segment(tenant_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_theme(theme_id, request) ⇒ FusionAuth::ClientResponse

Updates the theme with the given Id.

Parameters:

  • theme_id (string)

    The Id of the theme to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new theme information.

Returns:



2612
2613
2614
2615
2616
2617
2618
# File 'lib/fusionauth/fusionauth_client.rb', line 2612

def update_theme(theme_id, request)
  start.uri('/api/theme')
      .url_segment(theme_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_user(user_id, request) ⇒ FusionAuth::ClientResponse

Updates the user with the given Id.

Parameters:

  • user_id (string)

    The Id of the user to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user information.

Returns:



2626
2627
2628
2629
2630
2631
2632
# File 'lib/fusionauth/fusionauth_client.rb', line 2626

def update_user(user_id, request)
  start.uri('/api/user')
      .url_segment(user_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_user_action(user_action_id, request) ⇒ FusionAuth::ClientResponse

Updates the user action with the given Id.

Parameters:

  • user_action_id (string)

    The Id of the user action to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user action information.

Returns:



2640
2641
2642
2643
2644
2645
2646
# File 'lib/fusionauth/fusionauth_client.rb', line 2640

def update_user_action(user_action_id, request)
  start.uri('/api/user-action')
      .url_segment(user_action_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_user_action_reason(user_action_reason_id, request) ⇒ FusionAuth::ClientResponse

Updates the user action reason with the given Id.

Parameters:

  • user_action_reason_id (string)

    The Id of the user action reason to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new user action reason information.

Returns:



2654
2655
2656
2657
2658
2659
2660
# File 'lib/fusionauth/fusionauth_client.rb', line 2654

def update_user_action_reason(user_action_reason_id, request)
  start.uri('/api/user-action-reason')
      .url_segment(user_action_reason_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

Updates a single User consent by Id.

Parameters:

  • user_consent_id (string)

    The User Consent Id

  • request (OpenStruct, Hash)

    The request that contains the user consent information.

Returns:



2668
2669
2670
2671
2672
2673
2674
# File 'lib/fusionauth/fusionauth_client.rb', line 2668

def update_user_consent(user_consent_id, request)
  start.uri('/api/user/consent')
      .url_segment(user_consent_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#update_webhook(webhook_id, request) ⇒ FusionAuth::ClientResponse

Updates the webhook with the given Id.

Parameters:

  • webhook_id (string)

    The Id of the webhook to update.

  • request (OpenStruct, Hash)

    The request that contains all of the new webhook information.

Returns:



2682
2683
2684
2685
2686
2687
2688
# File 'lib/fusionauth/fusionauth_client.rb', line 2682

def update_webhook(webhook_id, request)
  start.uri('/api/webhook')
      .url_segment(webhook_id)
      .body_handler(FusionAuth::JSONBodyHandler.new(request))
      .put()
      .go()
end

#validate_device(user_code, client_id) ⇒ FusionAuth::ClientResponse

Validates the end-user provided user_code from the user-interaction of the Device Authorization Grant. If you build your own activation form you should validate the user provided code prior to beginning the Authorization grant.

Parameters:

  • user_code (string)

    The end-user verification code.

  • client_id (string)

    The client id.

Returns:



2697
2698
2699
2700
2701
2702
2703
# File 'lib/fusionauth/fusionauth_client.rb', line 2697

def validate_device(user_code, client_id)
  startAnonymous.uri('/oauth2/device/validate')
      .url_parameter('user_code', user_code)
      .url_parameter('client_id', client_id)
      .get()
      .go()
end

#validate_jwt(encoded_jwt) ⇒ FusionAuth::ClientResponse

Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly signed and not expired. <p> This API may be used to verify the JWT as well as decode the encoded JWT into human readable identity claims.

Parameters:

  • encoded_jwt (string)

    The encoded JWT (access token).

Returns:



2713
2714
2715
2716
2717
2718
# File 'lib/fusionauth/fusionauth_client.rb', line 2713

def validate_jwt(encoded_jwt)
  startAnonymous.uri('/api/jwt/validate')
      .authorization('JWT ' + encoded_jwt)
      .get()
      .go()
end

#verify_email(verification_id) ⇒ FusionAuth::ClientResponse

Confirms a email verification. The Id given is usually from an email sent to the user.

Parameters:

  • verification_id (string)

    The email verification id sent to the user.

Returns:



2725
2726
2727
2728
2729
2730
# File 'lib/fusionauth/fusionauth_client.rb', line 2725

def verify_email(verification_id)
  startAnonymous.uri('/api/user/verify-email')
      .url_segment(verification_id)
      .post()
      .go()
end

#verify_registration(verification_id) ⇒ FusionAuth::ClientResponse

Confirms an application registration. The Id given is usually from an email sent to the user.

Parameters:

  • verification_id (string)

    The registration verification Id sent to the user.

Returns:



2737
2738
2739
2740
2741
2742
# File 'lib/fusionauth/fusionauth_client.rb', line 2737

def verify_registration(verification_id)
  startAnonymous.uri('/api/user/verify-registration')
      .url_segment(verification_id)
      .post()
      .go()
end