# שגיאת אימות גם כאשר הפרמטר הועבר בעת הפעלת ה-API של Data Explorer עם Curl

**URL:** <https://meta.discourse.org/t/validation-error-even-when-parameter-passed-while-running-data-explorer-api-with-curl/191341>\
**Category:** Product Support\
**Created:** [23 במאי,‏ 2021,‏ 6:34am UTC](https://meta.discourse.org/t/validation-error-even-when-parameter-passed-while-running-data-explorer-api-with-curl/191341 "2021-05-23T06:34:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Himanshu\_Singh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/himanshu_singh/32/216438_2.png) [@Himanshu\_Singh](https://meta.discourse.org/u/Himanshu_Singh)\
**Post date:** [23 במאי,‏ 2021,‏ 6:34am UTC](https://meta.discourse.org/t/validation-error-even-when-parameter-passed-while-running-data-explorer-api-with-curl/191341/1 "2021-05-23T06:34:47Z")

</div>

I have looked at forum answers but I still can’t make it to work. The function does not want to take a `user_param` parameter I have defined in the query.

**Error:** Array ( [success] =\> [errors] =\> Array ( [0] =\> DataExplorer::ValidationError: Missing parameter user\_param of type int ) )

**The query:**

```plaintext
-- [params]
-- int :user_param

SELECT Count(likes_received) total_likes_received 
from user_stats us
where us.user_id = :user_param

```

**The code:**

```plaintext
<?php global $post;

$current_user_id = get_current_user_id();

$user_discourse_id = (int)get_user_meta($current_user_id,'discourse_sso_user_id')[0];
//api credentials,
$api_key = 'key';
$api_username = 'name';
$post_fields = array(
    'user_param' => $user_discourse_id,
);

$headers = array("Content-Type: multipart/form-data;","Api-Key: $api_key","Api-Username: $api_username",);
$url = 'https://domain/admin/plugins/explorer/queries/9/run';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_fields );

$result = curl_exec( $ch );
if ( curl_errno( $ch ) !== 0 ) {
    // Handle error, call curl_close( $ch ) and return.
	echo 'error';
	curl_close ($ch);
	return;
}

curl_close( $ch );
$decoded_result = json_decode( $result, true );
print_r($decoded_result);

?>

```

I have generated value for $post\_fields with and without http\_build\_query but still parameter is not passed to [data explorer](https://meta.discourse.org/t/32566?silent=true).

This was working a month ago with http\_build\_query and now it is not. What am I missing here?

Update:  
I even tried to pass the array manually and still the same error. Has something recently changed in the plugin?

`curl_setopt( $ch, CURLOPT_POSTFIELDS, array('user_param'=>'25'));`  
`curl_setopt( $ch, CURLOPT_POSTFIELDS, array('user_param'=> 25));`

---

_[View the full topic](https://meta.discourse.org/t/validation-error-even-when-parameter-passed-while-running-data-explorer-api-with-curl/191341)._
