The reference is your key to a comprehensive understanding of the Fadfed API.
This document explains how to use Fadfed's api server. This is the entry point of the app.
It is used mainly for Auth, User profile update and file uploads.
token to send requests to the API endpoints. See below how to to generate a valid token.devid param to all all request.session-id param and X-SESSION-ID header.User-Agent header to Fadfed/{version}({platform}/{platformVersion}) for example for Android app we use Fadfed/4.7.7(Android/14)There's multiple degrees to authentication used in this API server.
devid and tokenSee below an explanation of each type.
We use a token we generate using this formula to authenticate that requests are coming through the app and valid. this is a legacy request authentication system that we might remove in the future.
Token = md5 of SESSION_ID using DEVID as key.
JavaScript
import crypto from "crypto";
const token = crypto.createHmac('md5', SESSION_ID).update(DEVID).digest('hex');
Similar to Token based authentication, we should use Basic auth using devid for username and token for password ei: set Authorization header to basic base64(devid:token)
For app users, there's multiple ways to create an account. For iOS app users there's only login using apple ID, but for Android there's Google, Huawei and Facebook. Once signed up, the API returns a JWT auth token that needs to be sent with all subsequent request as the auth request query param.
If token. basic token or auth key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code with a message that specifies which authentication parameter is missing/invalid.
We have two environments production and development.
For local development the default endpoint is http://localhost:5100/
For development the base URL we use is: https://dev.wefaaq.net/api
for Production the base endpoint is: https://v2.fadfedly.com/api
Each app in the Fadfed system is identified by an id we call tenant
To Send a request to a specific tenant add @tenant as the first path of the base URL.
fadfedxchitterhopchatchillofadfedanonymousFor Example if we want to make request for the Fadfed app we would in development we would use https://dev.wefaaq.net/api/@fadfedx
If we want to do that in local development we would use http://localhost:5100/fadfedx
Rate-limited requests will return a "rate_limited" error code (HTTP response status 429). The rate limit for incoming requests per integration is an average of three requests per second. Some bursts beyond the average rate are allowed.
HTTP response codes are used to indicate general classes of success and error.
| HTTP Status Quote | Description |
|---|---|
| 200 | Successfully processed request. |
Error responses contain more detail about the error in the response body, in the "code" and "message"properties.
| HTTP Status Quote | code |
message |
|---|---|---|
| 400 | invalid_json | The request body could not be decoded as JSON |
| invalid_request_url | This request URL is not valid. | |
| invalid_request | This request is not supported. | |
| 401 | unauthorized | The bearer token is not valid. |