---
title: SLRequest
framework: social
role: symbol
role_heading: Class
path: social/slrequest
---

# SLRequest

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

## Declaration

```swift
class SLRequest
```

## Overview

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:) method to initialize a newly created SLRequest object passing the required property values. Use the addMultipartData(_:withName:type:) to optionally specify a multipart POST body. After you create your request, use the 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() method to create the request that you send using an NSURLConnection object. If the request requires user authorization, set the account property to an ACAccount object. Table 1  Social Services Individual Documentation Sites  |   |   |   |  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

- [init(forServiceType:requestMethod:url:parameters:)](social/slrequest/init(forservicetype:requestmethod:url:parameters:)-2cnf1.md)
- [SLServiceTypeFacebook](social/slservicetypefacebook.md)
- [SLServiceTypeTwitter](social/slservicetypetwitter.md)
- [SLServiceTypeSinaWeibo](social/slservicetypesinaweibo.md)
- [SLServiceTypeLinkedIn](social/slservicetypelinkedin.md)
- [SLServiceTypeTencentWeibo](social/slservicetypetencentweibo.md)

### Sending a Request

- [perform(handler:)](social/slrequest/perform(handler:).md)
- [SLRequestHandler](social/slrequesthandler.md)

### Providing User Credentials

- [account](social/slrequest/account.md)

### Getting the Request Details

- [preparedURLRequest()](social/slrequest/preparedurlrequest().md)
- [requestMethod](social/slrequest/requestmethod.md)
- [SLRequestMethod](social/slrequestmethod.md)
- [url](social/slrequest/url.md)
- [parameters](social/slrequest/parameters.md)

### Adding Data to the Request

- [addMultipartData(_:withName:type:filename:)](social/slrequest/addmultipartdata(_:withname:type:filename:).md)
- [addMultipartData(_:withName:type:)](social/slrequest/addmultipartdata(_:withname:type:).md)

### Initializers

- [init(forServiceType:requestMethod:URL:parameters:)](social/slrequest/init(forservicetype:requestmethod:url:parameters:)-92b1d.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
