API from server
This API is used to Post Events from your server directly to Conscent.ai This is the recommended way of Posting an Event.
Authorization :
POST
https://api.Conscent.club/reward/{partner_id}/api/user_event
Header: {API Key}
Path Parameters
Unique Identifier for the Partner
Request Body
curl --request POST \
--url https://api.Conscent.club/reward/partner_id/api/user_event \
--header 'X-API-KEY: {API Key}' \
--header 'accept: text/plain' \
--header 'content-type: application/json' \
--data '
{
"eventType": "ORDER_PLACED",
"userId": "42bede01c83fa3947"
}
'
const options = {
method: 'POST',
headers: {
accept: 'text/plain',
'content-type': 'application/json',
'X-API-KEY': '{API Key}'
},
body: JSON.stringify({eventType: 'ORDER_PLACED', userId: '42bede01c83fa3947'})
};
fetch('https://api.Conscent.club/reward/partner_id/api/user_event', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Installation:
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.Conscent.club/reward/partner_id/api/user_event', [
'body' => '{"eventType":"ORDER_PLACED","userId":"42bede01c83fa3947"}',
'headers' => [
'X-API-KEY' => '{API Key}',
'accept' => 'text/plain',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
Installation:
$ npm install api --save
const request = require('request');
const options = {
method: 'POST',
url: 'https://api.Conscent.club/reward/partner_id/api/user_event',
headers: {
accept: 'text/plain',
'content-type': 'application/json',
'X-API-KEY': '{API Key}'
},
body: {eventType: 'ORDER_PLACED', userId: '42bede01c83fa3947'},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});