Swati
Swati

Reputation: 61

how to create an events in facebook using graph api

I am creating facebook application.I want to create a event.I tried following url but does not work for me. https://graph.facebook.com/profileid/events?access_token=generatedaccess_token&name=somename&location=locationname I am getting json output with blank data.There is nothing in data tag.When I adding method=post,gives me error saying that invalid parameter.

Upvotes: 0

Views: 762

Answers (1)

Andrew Haller
Andrew Haller

Reputation: 270

In order to create an event, you have to issue an HTTP POST request. This is straight from the facebook graph api documentation: http://developers.facebook.com/docs/reference/api/page/#events

An HTTP POST request is basically like submitting a form with method="post". You can use cURL to do this fairly easily:

curl \
    –F 'access_token=[PAGE_ACCESS_TOKEN]' \
    -F 'batch=[ \
          { "method": "POST", \
            "relative_url": "[PAGE_ID]/events", \
            "body": "name=[EVENT_NAME]&start_time=[UNIX_TIMESTAMP]" \
          }, \
        ]'\
    https://graph.facebook.com

You can refer to the section on batch request for more help on this: http://developers.facebook.com/docs/reference/api/batch/

Upvotes: 1

Related Questions