2

Im working with an api which stores data into a JSON file. This data is gathered from a form that the users fill in my website. The way its inserted goes as follow:

$pers_payload = array(
 'gender' => 'Unknown', //or Male / Female
 'first_name' => $_POST['billing_first_name'],
 'family_name' => $_POST ['billing_last_name'],
 'email' => $_POST['billing_email'],
 'linked_as_contact_to_organization' => array(
 array(
 'organization_id' => $organization_id, // add the person as a contact to the newly created organization
 'work_email' => $_POST['billing_email'],
 'work_phone' => $_POST['billing_phone']
 )
 ),
 'visiting_address' => array(
 'country_code' => 'NL'
 ), // can be extented with other address data
 'postal_address' => array(
 'country_code' => $_POST['billing_country'] 
 ) // can be extented with other address data
);

And then:

$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));

Now instead of post i want to get the data. I tried getting data like this:

$SimplicateApi->makeApiCall('GET','/crm/organization?q[name]=*my name*');

I dont know if this is the right way, well it didn't work so obviously its not.

Anyways what im trying to achieve is with PHP i want to gather the name value of an existing person. this data is stored in /api/v2/crm/person.json

Api documentation (which i read but didn't understand to well) http://api.simplicate.nl/

asked Nov 28, 2016 at 8:52
8
  • Could you not just replace $_POST with $_REQUEST in your array constructor? Commented Nov 28, 2016 at 8:57
  • From what I can tell, the second request, meaning $SimplicateApi->makeApiCall('POST','/crm/organization?q[name]=*my name*'); should be GET instead of POST. Other than that, I don't necessarily see anything wrong. Commented Nov 28, 2016 at 8:59
  • @Andrew sorry i tried get too, something went wrong with copy pasting. But i tried it already Commented Nov 28, 2016 at 9:01
  • Do you get any errors when making the call? Commented Nov 28, 2016 at 9:02
  • @Andrew nothing at all sadly. Commented Nov 28, 2016 at 9:08

1 Answer 1

2

It's been a while but i'm trying to answer all my open questions without an answer which i ended up solving on my own.

So for this.

You have to create a variable which makes the get request like this:

$test = $SimplicateApi->makeApiCall('GET','/crm/organization?q[name]=My name');

Now you can for example do a var_dump($test);

And as output you will get all the data inside

/crm/organization?q[name]=My name

answered Dec 8, 2016 at 14:21
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.