Usage_Reports::call_api( $request )

call_api


Return Return

(void)


Source Source

File: src/core/classes/class-usage-reports.php

	public function call_api() {

		$api_url = apply_filters( 'automator_api_url', AUTOMATOR_API_URL ) . 'v2/report';

		$data = $this->get_data();

		$response = wp_remote_post(
			$api_url,
			array(
				'method' => 'POST',
				'body'   => array(
					'action' => 'save',
					'data'   => $data,
				),
			)
		);

		$body = json_decode( wp_remote_retrieve_body( $response ), true );

		$this->schedule_next_report( $body );

		return;

	}