<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Social",
  "identifier" : "/documentation/Social/SLRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Social"
    ],
    "preciseIdentifier" : "c:objc(cs)SLRequest"
  },
  "title" : "SLRequest"
}
-->

# SLRequest

An object that you use to assemble an HTTP request for communicating with a social media service.

```
class SLRequest
```

## Overview

The SLRequest object encapsulates the properties of an HTTP request, providing a convenient template for you to make requests. You send a request to a social networking service to perform some operation on behalf of the user or to retrieve user information.

HTTP requests have these common components: an HTTP request method (GET, POST, PUT, or DELETE), a URL identifying the operation to perform, a set of query parameters, and an optional multipart POST body that contains additional data. The values for these properties depend on the request you are sending and the target service provider. Refer to each supported social networking site’s documentation for possible values. Links to documentation are provided in Table 1.

Use the [`init(forServiceType:requestMethod:url:parameters:)`](/documentation/Social/SLRequest/init(forServiceType:requestMethod:url:parameters:)-2cnf1) method to initialize a newly created `SLRequest` object passing the required property values. Use the [`addMultipartData(_:withName:type:)`](/documentation/Social/SLRequest/addMultipartData(_:withName:type:)) to optionally specify a multipart POST body. After you create your request, use the [`perform(handler:)`](/documentation/Social/SLRequest/perform(handler:)) method to send the request, specifying the handler to call when the request is done.

If you already have a sending mechanism, you can use the [`preparedURLRequest()`](/documentation/Social/SLRequest/preparedURLRequest()) method to create the request that you send using an <doc://com.apple.documentation/documentation/Foundation/NSURLConnection> object. If the request requires user authorization, set the [`account`](/documentation/Social/SLRequest/account) property to an <doc://com.apple.documentation/documentation/Accounts/ACAccount> object.

Table 1  Social Services Individual Documentation Sites

|Facebook  |<https://developers.facebook.com/docs/>|
|----------|---------------------------------------|
|Sina Weibo|<http://open.weibo.com/wiki/>          |
|Twitter   |<https://dev.twitter.com/docs>         |
|LinkedIn  |<https://developer.linkedin.com/rest>  |

> Important:
> For Sina Weibo integration, users must have the Chinese keyboard enabled. Users can enable this keyboard in Settings > General > Keyboard. If a Chinese keyboard is not enabled, users won’t be prompted to sign in to their Sina Weibo account.

## Topics

### Initializing Requests

[`+  requestForServiceType:requestMethod:URL:parameters:`](/documentation/Social/SLRequest/init(forServiceType:requestMethod:url:parameters:)-2cnf1)

Initializes a newly created request object with the specified properties.

[`SLServiceTypeFacebook`](/documentation/Social/SLServiceTypeFacebook)

[`SLServiceTypeTwitter`](/documentation/Social/SLServiceTypeTwitter)

[`SLServiceTypeSinaWeibo`](/documentation/Social/SLServiceTypeSinaWeibo)

[`SLServiceTypeLinkedIn`](/documentation/Social/SLServiceTypeLinkedIn)

[`SLServiceTypeTencentWeibo`](/documentation/Social/SLServiceTypeTencentWeibo)

### Sending a Request

[`-  performRequestWithHandler:`](/documentation/Social/SLRequest/perform(handler:))

Performs an asynchronous request and calls the specified handler when done.

[`SLRequestHandler`](/documentation/Social/SLRequestHandler)

The callback handler for a request.

### Providing User Credentials

[`account`](/documentation/Social/SLRequest/account)

Account information used to authenticate the request.

### Getting the Request Details

[`-  preparedURLRequest`](/documentation/Social/SLRequest/preparedURLRequest())

Returns an authorized URL request that can be sent using an <doc://com.apple.documentation/documentation/Foundation/NSURLConnection> object.

[`requestMethod`](/documentation/Social/SLRequest/requestMethod)

The method to use for this request.

[`SLRequestMethod`](/documentation/Social/SLRequestMethod)

Indicates the request method used in the request.

[`URL`](/documentation/Social/SLRequest/url)

The destination URL for this request.

[`parameters`](/documentation/Social/SLRequest/parameters)

The parameters for this request.

### Adding Data to the Request

[`-  addMultipartData:withName:type:filename:`](/documentation/Social/SLRequest/addMultipartData(_:withName:type:filename:))

Specifies a named multipart POST body for this request.

[`-  addMultipartData:withName:type:`](/documentation/Social/SLRequest/addMultipartData(_:withName:type:))

Specifies a named multipart POST body for this request.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)