When i do something link this in PHP:
$params = array(
'person' => array(
'email' => '[email protected]','home_address' => array('country' => 'Germany', 'zip' => '66666' ))
);
$header = array('Authorization:' => $token,'Content-Type:' => 'application/json', 'Accept:' => 'application/json');
$response = $client->fetch($baseApiUrl . '/api/v1/people/push?access_token=myaccesstoken', $params, 'PUT',$header);
print_r($response);
i get the following response
Array
(
[result] => Array
(
[code] => missing_parameters
[message] => Missing Parameters.
[parameters] => Array
(
[0] => person
)
[inner_error] => Array
(
[name] => Api::Error::MissingParameters
[message] => Missing parameters: person
)
)
[code] => 400
[content_type] => application/json
)
Whats wrong with the Parameters? Do i need to add something else to the Params?
Alexander, I sent you an email with a proposed solution; let me know if that works for you.
thanks, Arion Hardison
Showing 13 reactions
Sign in with
Certified Architect
Certified Expert
Certified Developer
Certified Architect
Certified Expert
Certified Developer
Input Parameters:
{"person":{"email":“[email protected]”,“first_name”:“Eric”,“last_name”:“BobsTest”,“phone”:“213-423-4234”,“party”:“O”,“sex”:“O”,“employer”:“unknown”,“registered_address”:{"address1":“1911 W. Test Street”,“address2”:“null”,“country_code”:“US”,“city”:“Fountain”,“state”:“CO”,“zip”:"80901"}}}
Response:
{
“person”: {
“birthdate”: null,
“city_district”: null,
“civicrm_id”: null,
“county_district”: null,
“county_file_id”: null,
“created_at”: “2014-06-16T17:30:54-04:00”,
“do_not_call”: false,
“do_not_contact”: false,
“dw_id”: null,
“email”: “[email protected]”,
“email_opt_in”: true,
“employer”: “unknown”,
“external_id”: null,
“federal_district”: null,
“fire_district”: null,
“first_name”: “Eric”,
“has_facebook”: false,
“id”: 1632,
“is_twitter_follower”: false,
“is_volunteer”: false,
“judicial_district”: null,
“labour_region”: null,
“last_name”: “Reid”,
“linkedin_id”: null,
“mobile”: null,
“mobile_opt_in”: true,
“nbec_guid”: null,
“ngp_id”: null,
“note”: null,
“occupation”: null,
“party”: “O”,
“pf_strat_id”: null,
“phone”: “213-423-4234”,
“precinct_id”: null,
“primary_address”: {
“address1”: “1912 W Test St”,
“address2”: “null”,
“address3”: null,
“city”: “Fountain”,
“state”: “CO”,
“country_code”: “US”,
“zip”: “80901”,
“lat”: null,
“lng”: null
},
“recruiter_id”: null,
“rnc_id”: null,
“rnc_regid”: null,
“salesforce_id”: null,
“school_district”: null,
“school_sub_district”: null,
“sex”: “O”,
“state_file_id”: null,
“state_lower_district”: null,
“state_upper_district”: null,
“support_level”: null,
“supranational_district”: null,
“tags”: [],
“twitter_id”: null,
“twitter_name”: null,
“updated_at”: “2014-06-16T17:30:54-04:00”,
“van_id”: null,
“village_district”: null,
“active_customer_expires_at”: null,
“active_customer_started_at”: null,
“author”: null,
“author_id”: null,
“auto_import_id”: null,
“availability”: null,
“banned_at”: null,
“billing_address”: null,
“bio”: null,
“call_status_id”: null,
“call_status_name”: null,
“capital_amount_in_cents”: 0,
“children_count”: 0,
“church”: null,
“city_sub_district”: null,
“closed_invoices_amount_in_cents”: null,
“closed_invoices_count”: null,
“contact_status_id”: null,
“contact_status_name”: null,
“could_vote_status”: null,
“demo”: null,
“donations_amount_in_cents”: 0,
“donations_amount_this_cycle_in_cents”: 0,
“donations_count”: 0,
“donations_count_this_cycle”: 0,
“donations_pledged_amount_in_cents”: 0,
“donations_raised_amount_in_cents”: 0,
“donations_raised_amount_this_cycle_in_cents”: 0,
“donations_raised_count”: 0,
“donations_raised_count_this_cycle”: 0,
“donations_to_raise_amount_in_cents”: 0,
“email1”: “[email protected]”,
“email1_is_bad”: false,
“email2”: null,
“email2_is_bad”: false,
“email3”: null,
“email3_is_bad”: false,
“email4”: null,
“email4_is_bad”: false,
“ethnicity”: null,
“facebook_address”: null,
“facebook_profile_url”: null,
“facebook_updated_at”: null,
“facebook_username”: null,
“fax_number”: null,
“federal_donotcall”: false,
“first_donated_at”: null,
“first_fundraised_at”: null,
“first_invoice_at”: null,
“first_prospect_at”: null,
“first_recruited_at”: null,
“first_supporter_at”: “2014-06-16T17:30:54-04:00”,
“first_volunteer_at”: null,
“full_name”: “Eric BobsTest”,
“home_address”: null,
“import_id”: null,
“inferred_party”: null,
“inferred_support_level”: null,
“invoice_payments_amount_in_cents”: null,
“invoice_payments_referred_amount_in_cents”: null,
“invoices_amount_in_cents”: null,
“invoices_count”: null,
“is_deceased”: false,
“is_donor”: false,
“is_fundraiser”: false,
“is_ignore_donation_limits”: false,
“is_leaderboardable”: true,
“is_mobile_bad”: false,
“is_possible_duplicate”: false,
“is_profile_private”: false,
“is_profile_searchable”: true,
“is_prospect”: false,
“is_supporter”: true,
“is_survey_question_private”: false,
“language”: null,
“last_call_id”: null,
“last_contacted_at”: null,
“last_contacted_by”: null,
“last_donated_at”: null,
“last_fundraised_at”: null,
“last_invoice_at”: null,
“last_rule_violation_at”: null,
“legal_name”: null,
“locale”: null,
“mailing_address”: null,
“marital_status”: null,
“media_market_name”: null,
“meetup_address”: null,
“membership_expires_at”: null,
“membership_level_name”: null,
“membership_started_at”: null,
“middle_name”: null,
“mobile_normalized”: null,
“nbec_precinct_code”: null,
“note_updated_at”: null,
“outstanding_invoices_amount_in_cents”: null,
“outstanding_invoices_count”: null,
“overdue_invoices_count”: null,
“page_slug”: null,
“parent”: null,
“parent_id”: null,
“party_member”: false,
“phone_normalized”: “2134234234”,
“phone_time”: null,
“precinct_code”: null,
“precinct_name”: null,
“prefix”: null,
“previous_party”: null,
“primary_email_id”: 1,
“priority_level”: null,
“priority_level_changed_at”: null,
“profile_content”: null,
“profile_content_html”: null,
“profile_headline”: null,
“received_capital_amount_in_cents”: 0,
“recruiter”: null,
“recruits_count”: 0,
“registered_address”: {
“address1”: “1912 W Bijou St”,
“address2”: “null”,
“address3”: null,
“city”: “Colorado Springs”,
“state”: “CO”,
“country_code”: “US”,
“zip”: “80904”,
“lat”: null,
“lng”: null
},
“registered_at”: null,
“religion”: null,
“rule_violations_count”: 0,
“spent_capital_amount_in_cents”: 0,
“submitted_address”: null,
“subnations”: [],
“suffix”: null,
“support_level_changed_at”: null,
“support_probability_score”: null,
“turnout_probability_score”: null,
“twitter_address”: null,
“twitter_description”: null,
“twitter_followers_count”: null,
“twitter_friends_count”: null,
“twitter_location”: null,
“twitter_login”: null,
“twitter_updated_at”: null,
“twitter_website”: null,
“unsubscribed_at”: null,
“user_submitted_address”: null,
“username”: null,
“warnings_count”: 0,
“website”: null,
“work_address”: null,
“work_phone_number”: null,
“state_senate”: null,
“state_house”: null,
“signed_petition”: null,
“state_leader”: null,
“district_captain”: null,
“california_state_assembly”: null,
“california_state_senate”: null,
“district_code”: null
},
“precinct”: null
}
Output from PHP script: Same Parameters.
array(3) {
[“result”]=>
array(3) {
[“code”]=>
string(18) “missing_parameters”
[“message”]=>
string(19) “Missing Parameters.”
[“parameters”]=>
array(1) {
0=>
string(6) “person”
}
}
[“code”]=>
int(400)
[“content_type”]=>
string(16) “application/json”
}
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:’ => $token, ‘Content-Type:’ => ‘application/json’, ‘Accept:’ => ‘application/json’);
$response = $client->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!!