Skip to main content

Best Practices

Best Practices

Service Account

A common approach when using Fider API is to sign in with a generic email address (like admin@yourcompany.com), then switch to an Administrator user and promote the new user to an Administrator as well. This allows you to use a common user account on all API operations, without having to use a personal user account.

How to properly use impersonation

We usually recommend the usage of impersonation in combination with the Create User API. This API will retrieve or create a new user and returns its User ID, which can then be used to impersonate that user.

As an example, imagine that you have a Mobile App that lists all your Fider posts and you want to let the user vote on it via your App. The first step is to call Create User with the name, email and an optional (altough recommended) reference ID. The API will the return a user ID. It might be a new user ID or an existing one, it doesn't matter. Call the Add Vote API with the X-Fider-UserID parameter to execute this action under that user account.