In case you feel the need to use our backend REST API due to some extreme edge cases that our SDK API doesn't support, you can use request API that is also internally used by our SDK to make any backend request.

Request

request API lets you easily make a backend request without needing to manually create needed endpoints with set of query parameters, add authorisation token in a given format, etc.

LiveLike.request({
  path: '/user-quest-rewards/',
  // queryParams could be list of string or just string
  // list of string is useful to include query params with same key
  // for eg: <url>?fruit=apple&fruit=orange
  queryParams: {
    "user_quest_id": [ "user-quest-id-1", "user-quest-id-2", "user-quest-id-3" ],
    "reward_status": LiveLike.QuestRewardStatus.CLAIMED
  },
  method: LiveLike.HTTP_METHOD.GET,
  headers: {
    // any custom headers to be included
  }
}).then(res => console.log(res))

Authorization

In case you need to pass your own authorisation token, you can use createUserProfileAuthor createPersonalApiAuth API that takes a token string as argument and returns authorisation value

createUserProfileAuth

const accessToken = LiveLike.userProfile.access_token;
LiveLike.request({
    auth: LiveLike.createUserProfileAuth(accessToken),
  	// rest of the request args 
}).then(res => console.log(res))

createPersonalApiAuth

Be extra careful when defining and accessing personal API token, for eg: do not commit personal API token in code base and inject it using environment variables

const personApiToken = ENV.PERSONAL_API_TOKEN;
LiveLike.request({
    auth: LiveLike.createPersonalApiAuth(personApiToken),
  	// rest of the request args 
}).then(res => console.log(res))