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

People Create Endpoint and PHP.

Hello, I am trying to create an application with People Create Endpoint and the PHP API.
'Get Peoples' works perfect but when I try to add a new person in my Nation, the problems begin.
My token is valid, because I tested it with the new API Explorer tool.
My example with GET is:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people /'. )
print_r ( $ response );

This shows all the Peoples in my nation.
And this is the example I'm using with POST:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
/ *
$ data = array (
    'person ' = > array (
        'email' = > ' bob@example.com ' , " last_name " = > " Smith ", " first_name " = > "Bob"
    )
) ;
$ data_string = json_encode ( $ data );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people / ', $ data_string , "POST" . )
print_r ( $ response );
I'm not getting any response neither in the browser nor in the curl_request_info file.
What is wrong with my code?
I'm using Ryan Morgan's library ( https://github.com/RyanMorgan/PHP-OAuth2 ) .
I hope someone can help me or show me one example of how to do a POST Request for People correctly?
Thank you very much!
Share this post

Showing 7 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.