Skip to main content
If you are organizing essential services or emergency response to COVID-19, activate your free account

Activity

published People Credentials in API Developers Forum
posted 2014-07-30 13:30:21 -0700
followed PUT Method on Blog Posts API Example
posted 2013-12-27 04:52:21 -0800
commented on PUT to people API via PHP
Hi Arion, i am having the same problem as Alexander.
In my case i was trying to create a new blog post with the POST method but I have not succeeded yet.

The API Key works fine because I tested with the new API explorer tool.

$token = ‘mytoken’;
$baseApiUrl = ‘https://johndoe.nationbuilder.com’;
$client->setAccessToken($token);

//$people = $client->fetch($baseApiUrl . ‘/api/v1/people/’);

$body = ‘{
“blog_post”: {
“name”: “You will neves”,
“slug”: “new_post2”,
“status”: “published”,
“content_before_flip”: “<p>You will never guess what is after the flip</p>”,
“content_after_flip”: “<p>The answer is words. Words were after the flip.</p>”,
“tags”: [“funny”, “true”],
“published_at”: “2013-04-25T10:47:06-07:00”
}
}’;

$header = array(‘Authorization:’ =&gt; $token, ‘Content-Type:’ =&gt; ‘application/json’, ‘Accept:’ =&gt; ‘application/json’);

$response = $client-&gt;fetch($baseApiUrl . ‘/api/v1/sites/johndoe/pages/blogs/1/posts/push?access_token=mytoken’, $body, ‘POST’, $header);

print_r($response);

I do not get any response in my browser, not exactly what I’m doing wrong.

Any help that you could offer would be sincerely appreciated.
Thanks!!
posted 2014-04-03 13:12:24 -0700