Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
    • Dialogs
    • FQL
    • Internationalization
    • Ads API
    • Credits
    • Chat API
    • Legacy REST API
    • Legacy FBML
    • Legacy FBJS
    • Legacy Javascript SDK
  • SDK Reference
  • Tools
  • Administrative Methods
    • admin.banUsers
    • admin.getAllocation
    • admin.getAppProperties
    • admin.getBannedUsers
    • admin.getRestrictionInfo
    • admin.setAppProperties
    • admin.setRestrictionInfo
    • admin.unbanUsers
    • application.getPublicInfo
    • batch.run
    • data.setCookie
    • fbml.setRefHandle
    • intl.getTranslations
    • intl.uploadNativeStrings
    • links.getStats
    • migrations.getStatuses
    • migrations.setStatus
    • pages.blockFan
  • Login/Auth Methods
    • auth.createToken
    • auth.expireSession
    • auth.getSession
    • auth.promoteSession
    • auth.revokeAuthorization
    • auth.revokeExtendedPermission
  • Data Retrieval Methods
    • comments.get
    • data.getCookies
    • fbml.refreshImgSrc
    • fbml.refreshRefUrl
    • fql.multiquery
    • fql.query
    • friends.areFriends
    • friends.get
    • friends.getAppUsers
    • friends.getLists
    • friends.getMutualFriends
    • groups.get
    • groups.getMembers
    • links.get
    • message.getThreadsInFolder
    • notes.get
    • notifications.get
    • notifications.getList
    • pages.getinfo
    • pages.isAdmin
    • pages.isAppAdded
    • pages.isFan
    • photos.get
    • photos.getAlbums
    • photos.getTags
    • privacy.get
    • profile.getFBML
    • profile.getInfo
    • profile.getInfoOptions
    • status.get
    • stream.get
    • stream.getComments
    • stream.getFilters
    • users.getInfo
    • users.getLoggedInUser
    • users.getStandardinfo
    • users.hasAppPermission
    • users.isAppUser
    • users.isVerified
    • video.getUploadLimits
  • Publishing Methods
    • comments.add
    • comments.remove
    • links.post
    • links.preview
    • liveMessage.send
    • notes.create
    • notes.delete
    • notes.edit
    • notifications.markRead
    • notifications.sendEmail
    • photos.addTag
    • photos.createAlbum
    • photos.upload
    • profile.setFBML
    • profile.setInfo
    • profile.setInfoOptions
    • status.set
    • stream.addComment
    • stream.addLike
    • stream.publish
    • stream.remove
    • stream.removeComment
    • stream.removeLike
    • users.setStatus
    • video.upload
  • Facebook Connect Methods
    • Mobile Methods
      • sms.canSend
      • sms.send
    • Dashboard API Methods
      • dashboard.decrementCount
      • dashboard.getCount
      • dashboard.incrementCount
      • dashboard.multiGetCount
      • dashboard.multiIncrementCount
      • dashboard.multiSetCount
      • dashboard.setCount
    • Events API Methods
      • events.cancel
      • events.create
      • events.edit
      • events.get
      • events.getMembers
      • events.invite
      • events.rsvp
    • Custom Tags API Methods
      • fbml.deleteCustomTags
      • fbml.getCustomTags
      • fbml.registerCustomTags
    • Ads Methods

      admin.setRestrictionInfo

      Advanced Topics › Legacy REST API › admin.setRestrictionInfo
      Please note: We are in the process of deprecating the REST API, have added equivalent support to the Graph API for this method. You can retrieve and modify the Restrictions for your App by working with the 'restrictions' connection of the Application object

      Sets the demographic restrictions for the application. This call lets you restrict users at the application level. If you want to restrict only a portion of your application's content, use the fb:restricted-to tag instead.

      If the user doesn't match the age and location requirements, then the user cannot see the application at all. If the user's age is hidden for privacy reasons, Facebook still determines whether or not the application is visible to the user.

      You should make this call only as needed, when you need to set demographic restrictions. If the restrictions don't change, you don't need to make this call.

      Parameters

      NameTypeDescription
      callbackstring

      Name of a function to call. This is primarily to enable cross-domain JavaScript requests using the <script> tag, also known as JSONP, and works with both the XML and JSON formats. The function will be called with the response passed as the parameter.

      restriction_strstring

      A JSON-encoded string of the restricting attributes. Restrictions include age, location, age_distribution, and type. If you use the Facebook PHP client library, you can actually pass an associative array and Facebook automatically handles the JSON encoding. For example: {"age_distribution":"{\"CA,US\":\"16-25\",\"IN\":\"15-20,30+\"}"}.

      When specifying the age or age_distribution, you can use plus (+) and minus (-) to restrict content to that age or older/younger (like 21+ for 21 and older or 18- for younger than 19). You can also specify a range of ages, like 18-35 so anyone between the ages of 18 and 35 (inclusive) can see the content. You can also specify multiple age ranges (like 19-,30+ — if you want to exclude people in their 20s, for example). Every specified age must be an integer.

      When specifying the location, specify the country or countries (using a comma-separated list) from the ISO 3166 alpha 2 code list. This list is not necessarily the same as the IANA ccTLD (country code top level domain) list. For example, the ISO 3166 entry for England is .gb, while the IANA entry is .uk.

      Specifying a type allows you to target users based on age and location for custom made categories like alcohol (currently the only type available). Before rendering your FBML, we run a check against the type on Facebook, and if the user meets the age and location requirements, we'll render the content.

      Specifying an empty restriction_str resets all restrictions.

      Response

      This method returns true if the restrictions are successfully set.

      Updated about 6 months ago
      Facebook © 2012 · English (US)
      AboutCareersPlatform PoliciesPrivacy Policy