Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // $params has the authorization headers in it
- $params = wp_fusion()->crm->get_params();
- // This is the data for the new company
- $data = array(
- 'Company_Name' => 'Cool company',
- 'Another_Field' => 'More data'
- );
- $params['body'] = json_encode( array( 'data' => array( $data ) ) );
- $request = wp_fusion()->crm->api_domain . '/crm/v2/Companies';
- $response = wp_remote_post( $request, $params );
- // Check for any errors and display them if encountered
- if( is_wp_error( $response ) ) {
- wp_die( $response->get_error_message() );
- }
- $response = json_decode( wp_remote_retrieve_body( $response ) );
- $company_id = $response->data[0]->details->id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement