/
v3.0.11Get access

socialChoiceRequest

Generic and only request for the Social Choice service. It works as a PROXY: the request (HTTP method, path, query params and body) is sent to Swarm via the social_choice_me command, Swarm forwards it to the Social Choice API and returns the response to the user in the same shape, without any changes. Use it for every Social Choice endpoint (login, profile, links, stories, highlights, follow, reactions, notifications, suggestions, uploads, etc.) by passing the endpoint path and HTTP method.

Request parameters:

Name
DescriptionTypeValuesDefault
partnerId
The id of the partner. Must be a positive integer. Sent as PARTNER_IDnumber--
method
The HTTP method of the Social Choice API requeststring"GET", "PUT", "POST", "PATCH", "DELETE"-
path
The Social Choice API path, e.g. /api/v1/players or /api/v1/reactionsstring--
data
The request body sent to the Social Choice APIobject-
params
Additional query params, merged with PARTNER_ID and WL_IDobject-
wlId
The white label id. Must be a positive integer when provided. Sent as WL_ID; omitted when undefinednumber--

Call example:

socialChoiceRequest({
  partnerId: 1,
  method: 'POST',
  path: '/api/v1/player/profile/change-profile',
  data: {
    nik: 'Lizaa',
    title: 'Mona',
    description: 'Software Enginner'
  }
})

Response examples:

{
  code: 0,
  rid: 'd29326',
  data: {
    result: 0,
    result_text: 'OK',
    details: {
      error: false,
      message: 'OK.',
      data: {
        id: 23047,
        nikName: 'Lizaa',
        title: 'Mona',
        description: 'Software Enginner'
      }
    }
  }
}

Response parameters:

NameDescriptionTypeValues
result
The result code of the requestnumber-
result_text
The result text of the requeststring"null"
details
The Social Choice API responseobject
└─ error
True if the Social Choice API returned an errorbooleantrue / false
└─ message
The message returned by the Social Choice APIstring-
└─ data
The response data of the requested path. Its shape depends on the path and methodobject

Additional Information:

This is a proxy request. The SDK sends social_choice_me to Swarm with { path, method, params: { PARTNER_ID, WL_ID, ...params }, data }; Swarm forwards it to the Social Choice API and returns the result to the user in the same shape. No mapping or post-processing is applied.

Call example

socialChoiceRequest < SocialProfile > ({
  method: 'POST',
  path: '/api/v1/player/profile/link/add',
  partnerId: 1,
  data: {
    title: 'YouTube',
    url: 'https://youtube.com/@me'
  },
})