Data.setCookie

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This method sets a cookie for a given user and application.

You can set cookies for Web applications only; you cannot set cookies for desktop applications.

Parameters

RequiredNameTypeDescription
required uid int The user for whom this cookie needs to be set.
name string Name of the cookie.
value string Value of the cookie.
optional expires int Time stamp when the cookie should expire. If not specified, the cookie expires after 24 hours. (The time stamp can be longer than 24 hours and currently has no limit)
path string Path relative to the application's callback URL, with which the cookie should be associated. (Default value is /.)

Response

Returns 1 indicating success or 0 indicating failure.

Example Return XML

<?xml version="1.0" encoding="UTF-8"?> <data_setCookie_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</data_setCookie_response>

Error Codes

CodeDescription
1 An unknown error occurred. Please resubmit the request.
2 The service is not available at this time.
4 The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed.
5 The request came from a remote address not allowed by this application.
101 The API key submitted is not associated with any known application.
104 Incorrect signature.

Notes

  • This method does not require a session_key. Desktop applications should not call this method.
  • You can call this method using a session secret, and not the application secret (for example, for a Facebook Connect site).

See Also

reference