Monetate Engine API
Decision
Request Decisions
code examples curl location globoff 'https //engine monetate net/api/engine/v1/decide/{retailershortname}' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "events" \[ { "eventtype" "" } ] }'\<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //engine monetate net/api/engine/v1/decide/{retailershortname}', curlopt returntransfer => true, curlopt encoding => '', curlopt maxredirs => 10, curlopt timeout => 0, curlopt followlocation => true, curlopt http version => curl http version 1 1, curlopt customrequest => 'post', curlopt postfields =>'{ "events" \[ { "eventtype" "" } ] }', curlopt httpheader => array( 'accept application/json', 'content type application/json' ), )); $response = curl exec($curl); curl close($curl); echo $response; var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "events" \[ { "eventtype" "" } ] }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //engine monetate net/api/engine/v1/decide/{retailershortname}", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));import requests import json url = "https //engine monetate net/api/engine/v1/decide/{retailershortname}" payload = json dumps({ "events" \[ { "eventtype" "" } ] }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) require "uri" require "json" require "net/http" url = uri("https //engine monetate net/api/engine/v1/decide/{retailershortname}") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "events" \[ { "eventtype" "" } ] }) response = https request(request) puts response read body responses // the request was succesful and the payload will include valid actions { "data" { "responses" \[ { "requestid" "", "actions" \[ { "actiontype" "", "impressionid" "", "impressionreporting" \[ { "experience id" 0, "experience label" "", "experience name" "", "variant label" "", "is control" false, "control allocation" "", "experience type" "", "has targets" false, "tags" \[ "" ] } ] } ] } ] }, "meta" { "code" 0, "errors" \[ {} ], "monetateid" "", "warnings" \[ {} ] } }// invalid request the request was either malformated (did not follow this specification) or the data sent was invalid { "data" { "responses" \[ { "requestid" "", "actions" \[ { "actiontype" "", "impressionid" "", "impressionreporting" \[ { "experience id" 0, "experience label" "", "experience name" "", "variant label" "", "is control" false, "control allocation" "", "experience type" "", "has targets" false, "tags" \[ "" ] } ] } ] } ] }, "meta" { "code" 0, "errors" \[ {} ], "monetateid" "", "warnings" \[ {} ] } }