Record Show Results: Leads and Objective Ratings

Record a show's lead count and how well an Objective was met.

Example use case

The show has ended and you want to record the number of leads and how well an Objective was met.

What you'll end up with

A saved lead count and a saved rating for one Objective, with both results checked afterward.

Before you start

Have a workspace API key, an Event ID and an Objective ID from that Event. Your plan and key must allow ROI and Budget View access, and the Event's ROI area must allow edits.

Good to know

The Event and Objective are saved separately. Use each record's own revision.

At a glance

Time to try

About 10 minutes

Effect on your data

Updates records

Endpoints

5

The program updates the Event lead count and one Objective rating and writes a private local journal.

How it works

  1. The program reads the Event and Objective and checks that they belong together.
  2. It saves your lead count and rating separately, using each record's own revision.
  3. It reads both records again to check the saved values.

Record the lead count and Objective rating

The examples below set 48 leads and an Objective rating of 8 on a test Event. Your values come from EXHIBITDAY_LEAD_COUNT and EXHIBITDAY_ACHIEVEMENT_RATING.

Step 1: Confirm the workspace

Check where the key will make changes so you can confirm the workspace.

curl -X GET "https://api.exhibitday.com/v1/references/workspace_info" -H "Authorization: Bearer YOUR_API_KEY"

Example response (shortened)

{
  "id": 98765
}

Check: Confirm id is the workspace you intended to use.

Step 2: Read the Event and its revision

Read the current lead count and Event revision before changing the count.

curl -X GET "https://api.exhibitday.com/v1/events/info?id=5001&%24include_record_revision=true" -H "Authorization: Bearer YOUR_API_KEY"

Example response (shortened)

{
  "id": 5001,
  "roi_num_leads": 12,
  "roo_score": null,
  "record_revision": "COPY_EVENT_REVISION_FROM_YOUR_READ"
}

Check: Confirm the Event ID and keep this record_revision for the Event PATCH.

Step 3: Read the Objective and its revision

Read the selected Objective before assigning its achievement rating.

curl -X GET "https://api.exhibitday.com/v1/events/objectives/info?id=8001&%24include_record_revision=true" -H "Authorization: Bearer YOUR_API_KEY"

Example response (shortened)

{
  "id": 8001,
  "event_id": 5001,
  "achievement_rating": null,
  "record_revision": "COPY_OBJECTIVE_REVISION_FROM_YOUR_READ"
}

Check: Confirm event_id matches the selected Event. Keep this record_revision for the Objective PATCH.

Step 4: Save the lead count

Send roi_num_leads with the Event revision to guard against a conflicting change.

curl -X PATCH "https://api.exhibitday.com/v1/events" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" --data-binary "{\"id\":5001,\"roi_num_leads\":\"$env.EXHIBITDAY_LEAD_COUNT\",\"expected_revision\":\"COPY_EVENT_REVISION_FROM_YOUR_READ\"}"

Example response

{
  "status_code": 200,
  "status": "OK",
  "message": "Event Update Successful. Event properties that were changed: roi_num_leads",
  "errors": [],
  "record_revision": "NEW_EVENT_REVISION"
}

Check: Look for record_revision in the acknowledgement. The Objective rating is a separate save.

Step 5: Save the Objective rating

Send achievement_rating with the Objective revision and leave importance unchanged.

curl -X PATCH "https://api.exhibitday.com/v1/events/objectives" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" --data-binary "{\"id\":8001,\"achievement_rating\":\"$env.EXHIBITDAY_ACHIEVEMENT_RATING\",\"expected_revision\":\"COPY_OBJECTIVE_REVISION_FROM_YOUR_READ\"}"

Example response

{
  "status_code": 200,
  "status": "OK",
  "message": "Objective updated.",
  "errors": [],
  "record_revision": "NEW_OBJECTIVE_REVISION"
}

Check: Look for the Objective's record_revision. A failure here can leave the earlier lead count saved.

Step 6: Verify the Event lead count

Read the Event again to check the count that was saved.

curl -X GET "https://api.exhibitday.com/v1/events/info?id=5001" -H "Authorization: Bearer YOUR_API_KEY"

Example response (shortened)

{
  "id": 5001,
  "roi_num_leads": 48,
  "roo_score": 8.0
}

Check: Confirm the Event ID and the new lead count. ExhibitDay calculates roo_score separately.

Step 7: Verify the Objective rating

Read the Objective again to confirm the rating and its Event association.

curl -X GET "https://api.exhibitday.com/v1/events/objectives/info?id=8001" -H "Authorization: Bearer YOUR_API_KEY"

Example response (shortened)

{
  "id": 8001,
  "event_id": 5001,
  "achievement_rating": 8
}

Check: Confirm the Objective ID, Event ID and the achievement rating you supplied.

Try it

Before running the example

VariableWhat to put in itRequired?
EXHIBITDAY_API_KEYYour workspace API key.Yes
EXHIBITDAY_EVENT_IDThe ID of an existing Event you can edit.Yes
EXHIBITDAY_OBJECTIVE_IDThe ID of an existing Objective on that Event.Yes
EXHIBITDAY_LEAD_COUNTThe number of leads from the show, a whole number (0 or more).Yes
EXHIBITDAY_ACHIEVEMENT_RATINGHow well the Objective was met, a whole number from 0 through 10.Yes
EXHIBITDAY_JOB_IDA stable ID for this logical change.Yes
EXHIBITDAY_JOURNALA private local path for this job's journal.Yes
EXHIBITDAY_JOB_MODEUse new for a genuinely new job or resume with the existing journal. The default is resume.No

Bash

export EXHIBITDAY_API_KEY='YOUR_API_KEY'
export EXHIBITDAY_EVENT_ID='5001'
export EXHIBITDAY_OBJECTIVE_ID='8001'
export EXHIBITDAY_LEAD_COUNT='48'
export EXHIBITDAY_ACHIEVEMENT_RATING='8'

PowerShell

$env:EXHIBITDAY_API_KEY = 'YOUR_API_KEY'
$env:EXHIBITDAY_EVENT_ID = '5001'
$env:EXHIBITDAY_OBJECTIVE_ID = '8001'
$env:EXHIBITDAY_LEAD_COUNT = '48'
$env:EXHIBITDAY_ACHIEVEMENT_RATING = '8'

Use your own test Event and Objective IDs, lead count and rating. Set a private journal path and job ID. Set EXHIBITDAY_JOB_MODE=new for a new job, then run the complete example in your language.

Complete example program

Code Samples
#!/usr/bin/env bash
# Requires Bash, curl and Python3. No API key is written into the program.
python3 - <<'EXHIBITDAY_PY'
# Python 3; standard library only. Set EXHIBITDAY_API_KEY before running.
import http.client
import json
import os
import re
import time
import urllib.error
import urllib.parse
import urllib.request

BASE = "https://api.exhibitday.com/v1"
SPEC = json.loads("{\"preserveNumbers\":true,\"requests\":{\"workspace_binding\":{\"method\":\"GET\",\"path\":\"/references/workspace_info\"},\"read_event\":{\"method\":\"GET\",\"path\":\"/events/info\"},\"read_objective\":{\"method\":\"GET\",\"path\":\"/events/objectives/info\"},\"save_leads\":{\"method\":\"PATCH\",\"path\":\"/events\"},\"rate_objective\":{\"method\":\"PATCH\",\"path\":\"/events/objectives\"},\"verify_event\":{\"method\":\"GET\",\"path\":\"/events/info\"},\"verify_objective\":{\"method\":\"GET\",\"path\":\"/events/objectives/info\"}}}")
API_KEY = os.environ["EXHIBITDAY_API_KEY"]
if any(ord(char) < 32 or ord(char) > 126 for char in API_KEY):
    raise RuntimeError("Use the API key as one ASCII header value without control characters")
if not API_KEY.strip():
    raise RuntimeError("Set EXHIBITDAY_API_KEY")

def decode_json(text):
    if SPEC["preserveNumbers"]:
        # Quote JSON NUMBER tokens, never text inside a JSON string, to keep CSV decimals exact.
        text = re.sub(r'"(?:\\.|[^"\\])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?',
                      lambda m: m[0] if m[0].startswith('"') else json.dumps(m[0]), text)
    return json.loads(text)

from pathlib import Path
# This terminal version uses curl for HTTP and Python's standard library for JSON/CSV.
import subprocess
import tempfile

def transport(method, url, headers, data):
    with tempfile.TemporaryDirectory(prefix="exhibitday-guide-") as directory:
        folder = Path(directory)
        # curl may leave no output file for a valid bodyless304 response.
        (folder / "body").write_bytes(b"")
        command = ["curl", "--disable", "--silent", "--show-error", "--request", method, "--url", url,
                   "--max-time", "30", "--dump-header", str(folder / "headers"),
                   "--output", str(folder / "body"), "--write-out", "%{http_code}"]
        for name, value in headers.items():
            command += ["--header", name + ": " + value]
        if data is not None:
            (folder / "request").write_bytes(data)
            command += ["--data-binary", "@" + str(folder / "request")]
        result = subprocess.run(command, capture_output=True, text=True)
        if result.returncode:
            raise urllib.error.URLError(result.stderr.strip())
        response_headers = {}
        blocks = (folder / "headers").read_text(encoding="iso-8859-1").replace("\r\n", "\n").strip().split("\n\n")
        for line in blocks[-1].splitlines()[1:]:
            name, separator, value = line.partition(":")
            if separator:
                response_headers[name] = value.strip()
        return int(result.stdout), (folder / "body").read_bytes(), response_headers


class ApiError(RuntimeError):
    """An API error response. Branch on error_code (and status), never on the message text.
    uncertain is True when a PATCH or DELETE got no response or a server error: it may or may not have been applied."""
    def __init__(self, status, body, uncertain=False):
        self.status = status
        self.uncertain = uncertain
        self.error_code = body.get("error_code") if isinstance(body, dict) else None
        super().__init__(f"{body.get('error_code')} {body.get('error_params')}: {body.get('errors')} (request {body.get('request_id')})"
                         if isinstance(body, dict) else "HTTP " + str(status) if status else "No response")

def call(name, params=None, body=None, key=None):
    route = SPEC["requests"][name]
    headers = {"Authorization": "Bearer " + API_KEY, "Accept": "application/json"}
    if route["method"] == "POST":
        if not key: raise RuntimeError("Persist a logical create key before sending POST")
        headers["Idempotency-Key"] = key
    data = None if body is None else json.dumps(body).encode("utf-8")
    if data is not None:
        headers["Content-Type"] = "application/json"
    query = urllib.parse.urlencode(params or {})
    url = BASE + route["path"] + ("?" + query if query else "")
    # Only GET has automatic retries in this workflow. A PATCH or DELETE that got no response or a
    # server error is never resent blindly: it may already have been applied, so the caller reads the record first.
    resend = route["method"] == "GET"
    for attempt in range(5):
        try:
            status, raw, response_headers = transport(route["method"], url, headers, data)
        except (urllib.error.URLError, TimeoutError, ConnectionError, http.client.HTTPException):
            if not resend:
                raise ApiError(0, None, uncertain=True)
            if attempt == 4:
                raise
            time.sleep(2 ** attempt)
            continue
        response_headers = {k.lower(): v for k, v in response_headers.items()}
        result = None
        if status != 304 and raw:
            try:
                result = decode_json(raw.decode("utf-8"))
            except (ValueError, UnicodeError):
                if status < 400:
                    raise RuntimeError("Expected a JSON success response")
        if status >= 500 and not resend:
            raise ApiError(status, result, uncertain=True)
        retry = resend and (status == 429 or status >= 500)
        if retry:
            if attempt == 4:
                raise RuntimeError("Retry limit reached; check the request outcome before starting a new create")
            delay = response_headers.get("retry-after", str(2 ** attempt))
            time.sleep(max(0, float(delay)))
            continue
        if status >= 400:
            raise ApiError(status, result)
        return {"status": status, "body": result, "headers": response_headers, "raw": raw}
    raise RuntimeError("Retry limit reached")


def both(left,right):
    return left and right

def bounded_whole_number(value, name, maximum):
    if not re.fullmatch(r"0|[1-9][0-9]*", value) or len(value)>len(maximum) or (len(value)==len(maximum) and value>maximum):
        raise RuntimeError(name+" must be a whole number from 0 through "+maximum)
    return value

def either(left, right):
    if not isinstance(left, bool) or not isinstance(right, bool): raise RuntimeError("Expected Boolean criteria")
    return left or right

def equal(left, right):
    return type(left) is type(right) and left == right

def field(value, name):
    if not isinstance(value, dict) or name not in value: raise RuntimeError("Missing response field: " + name)
    return value[name]

def is_present(value):
    return value is not None and value != ""

"""Strict private client journal reference; no transport or application dependency."""
from pathlib import Path
import hashlib
import os
import re
import secrets
from urllib.parse import urlsplit

PREAMBLE=b'EXHIBITDAY-GUIDE-JOURNAL 1\n'

class JournalRefusal(RuntimeError):
    pass

def utf8(value):
    if not isinstance(value,str):raise JournalRefusal('Journal fields are exact strings')
    return value.encode('utf-8',errors='strict')

def strings(values):
    raw=bytearray()
    for value in values:
        item=utf8(value);raw.extend(str(len(item)).encode('ascii'));raw.extend(b':');raw.extend(item)
    return bytes(raw)

def read_strings(raw):
    values=[];offset=0
    while offset<len(raw):
        end=raw.find(b':',offset)
        if end<0:raise JournalRefusal('Incomplete journal string length')
        length=raw[offset:end]
        if not re.fullmatch(b'0|[1-9][0-9]*',length):raise JournalRefusal('Noncanonical journal string length')
        size=int(length);offset=end+1
        if size>len(raw)-offset:raise JournalRefusal('Incomplete journal string')
        values.append(raw[offset:offset+size].decode('utf-8',errors='strict'));offset+=size
    return values

def digest(raw):return hashlib.sha256(raw).hexdigest().upper()

def fingerprint(pairs):
    values=[]
    for name,value in sorted(pairs.items()):
        if not re.fullmatch('[A-Za-z0-9_.-]+',name):raise JournalRefusal('Fingerprint field names must be explicit ASCII identifiers')
        if name.lower() in ('api_key','exhibitday_api_key'):raise JournalRefusal('Never fingerprint the API key')
        values.extend((name,value))
    return digest(strings(values))

def frame(values):
    raw=strings(values)
    return str(len(raw)).encode('ascii')+b' '+digest(raw).encode('ascii')+b'\n'+raw+b'\n'

def decode(raw):
    if not raw.startswith(PREAMBLE):raise JournalRefusal('Unknown or incomplete journal version')
    offset=len(PREAMBLE);records=[]
    while offset<len(raw):
        end=raw.find(b'\n',offset)
        if end<0:raise JournalRefusal('Incomplete journal frame header; reconcile before retry')
        match=re.fullmatch(b'(0|[1-9][0-9]*) ([0-9A-F]{64})',raw[offset:end])
        if match is None:raise JournalRefusal('Invalid journal frame header')
        size=int(match[1]);offset=end+1
        if size>=len(raw)-offset:raise JournalRefusal('Incomplete journal frame; reconcile before retry')
        payload=raw[offset:offset+size];offset+=size
        if raw[offset:offset+1]!=b'\n' or digest(payload).encode('ascii')!=match[2]:raise JournalRefusal('Journal integrity check failed; reconcile before retry')
        records.append(read_strings(payload));offset+=1
    return records

class Journal:
    def __init__(self,path,base,workspace,slug,job,input_fingerprint,writes,mode="resume"):
        self.path=Path(path);self.lock=Path(str(self.path)+'.lock');self.fd=None;self.owned=False;self.identity=None;self.tainted=False;self.intents={};self.saved_values={}
        address=urlsplit(base)
        if address.scheme not in ('https','http')or not address.netloc or address.username is not None or address.query or address.fragment or not re.fullmatch('[a-z][a-z0-9-]*',slug):raise JournalRefusal('Use the actual API base and closed guide slug')
        if not job.strip() or not re.fullmatch('[1-9][0-9]*',workspace) or not re.fullmatch('[0-9A-F]{64}',input_fingerprint):raise JournalRefusal('Use an actual workspace, explicit stable job ID and exact input fingerprint')
        if mode not in ("new","resume"):raise JournalRefusal("Choose new or resume for this local job")
        self.allowed={};manifest=[]
        for step,method,route in writes:
            if not re.fullmatch('[a-z][a-z0-9_-]*',step)or step in self.allowed or method not in ('POST','PATCH','DELETE')or not re.fullmatch('/v1/[A-Za-z0-9_/-]+',route)or'//'in route:raise JournalRefusal('Use a closed unique write manifest')
            self.allowed[step]=(method,route);manifest.extend((step,method,route))
        if not self.allowed:raise JournalRefusal('Only write workflows need a restart journal')
        self.header=['H','1',base,workspace,slug,job,input_fingerprint,digest(strings(manifest))]
        strings(self.header)
        try:
            self.fd=os.open(self.lock,os.O_WRONLY|os.O_CREAT|os.O_EXCL,0o600);self.owned=True
        except FileExistsError:raise JournalRefusal('This journal is locked; do not run overlapping jobs or steal a stale lock')
        try:
            self.owner=secrets.token_hex(16);self.identity=os.fstat(self.fd)
            if os.write(self.fd,self.owner.encode('ascii'))!=len(self.owner):raise OSError('Incomplete lock identity write')
            os.fsync(self.fd)
            if self.path.is_symlink():raise JournalRefusal('Choose a private regular journal file')
            if mode=="resume" and not self.path.exists():raise JournalRefusal("Journal missing: stop and reconcile lost state before starting a new logical job")
            if mode=="new" and self.path.exists():raise JournalRefusal("A journal already exists; use resume for the same logical job")
            if mode=="new":
                with open(self.path,'xb',buffering=0)as target:
                    target.write(PREAMBLE+frame(self.header));os.fsync(target.fileno())
            records=decode(self.path.read_bytes())
            if not records or records[0]!=self.header:raise JournalRefusal('Journal workspace/base/guide/job/input binding differs')
            for record in records[1:]:self.apply(record)
            if any(step not in self.saved_values for step in self.intents):raise JournalRefusal('A saved before-send intent lacks an ACK; stop and reconcile its outcome before retry')
        except BaseException:
            self.close();raise

    def apply(self,record):
        if not record:raise JournalRefusal('Empty journal record')
        if record[0]=='I':
            if len(record)!=6:raise JournalRefusal('Invalid intent shape')
            _,step,method,path,request_fingerprint,key=record
            if not re.fullmatch('[a-z][a-z0-9_-]*',step)or step in self.intents or self.allowed.get(step)!=(method,path)or not re.fullmatch('[0-9A-F]{64}',request_fingerprint)or any(name not in self.saved_values for name in self.intents):raise JournalRefusal('Invalid, future or repeated journal intent')
            if method=='POST'and not re.fullmatch('[0-9a-f]{32}',key)or method!='POST'and key!='':raise JournalRefusal('Invalid persisted action key')
            self.intents[step]={'method':method,'path':path,'request_fingerprint':request_fingerprint,'idempotency_key':key}
        elif record[0]=='A':
            if len(record)<3:raise JournalRefusal('Invalid ACK shape')
            _,step,count,*pairs=record
            if not re.fullmatch('0|[1-9][0-9]*',count)or len(pairs)!=2*int(count)or step not in self.intents or step in self.saved_values:raise JournalRefusal('ACK without exactly one prior intent')
            names=pairs[::2]
            if names!=sorted(set(names))or any(not re.fullmatch('[a-z][a-z0-9_]*',name)or name in ('api_key','exhibitday_api_key')for name in names):raise JournalRefusal('ACK saved fields must be unique sorted secret-free identifiers')
            self.saved_values[step]=dict(zip(names,pairs[1::2]))
        else:raise JournalRefusal('Unknown journal transition')

    def append(self,record):
        # The reader commits state only after complete length/digest recognition.
        # A torn append is retained and refused, never silently truncated.
        self.require_active();raw=frame(record)
        try:
            with open(self.path,'ab',buffering=0)as target:
                view=memoryview(raw)
                while view:
                    written=target.write(view)
                    if not written:raise OSError('Journal write did not advance')
                    view=view[written:]
                os.fsync(target.fileno())
        except BaseException:
            self.tainted=True;raise

    def require_active(self):
        if not self.owned or self.fd is None or self.identity is None or self.tainted:raise JournalRefusal('The journal scope is closed or its IO outcome needs reconciliation')
        current=self.lock.stat(follow_symlinks=False)
        if current.st_dev!=self.identity.st_dev or current.st_ino!=self.identity.st_ino or self.lock.read_text(encoding='ascii')!=self.owner:raise JournalRefusal('The journal lock was replaced; stop without deleting it')
    def acknowledged(self,step):
        self.require_active();return step in self.saved_values
    def saved(self,step):
        self.require_active()
        if step not in self.saved_values:raise JournalRefusal('No acknowledged state exists for this step')
        return dict(self.saved_values[step])
    def begin(self,step,method,path,request_fingerprint):
        self.require_active()
        if step in self.intents:raise JournalRefusal('Never blindly repeat an existing action intent')
        key=secrets.token_hex(16)if method=='POST'else''
        record=['I',step,method,path,request_fingerprint,key]
        # Validate on an isolated state before touching the file.
        old=dict(self.intents)
        try:self.apply(record)
        finally:self.intents=old
        self.append(record);self.apply(record)
        return dict(self.intents[step])
    def acknowledge(self,step,saved):
        self.require_active()
        record=['A',step,str(len(saved))]
        for name,value in sorted(saved.items()):record.extend((name,value))
        old={name:dict(value)for name,value in self.saved_values.items()}
        try:self.apply(record);strings(record)
        finally:self.saved_values=old
        self.append(record);self.apply(record)
    def close(self):
        if self.owned:
            if self.tainted:
                os.close(self.fd);self.fd=None;self.owned=False
                return # Retain this lock after failed journal IO; manual reconciliation is required.
            try:self.require_active()
            except BaseException:
                os.close(self.fd);self.fd=None;self.owned=False;raise
            os.close(self.fd);self.fd=None;self.owned=False
            self.lock.unlink()
    def __enter__(self):return self
    def __exit__(self,*args):self.close()

def journal_values(value):
    if not isinstance(value, dict) or any(not isinstance(k, str) or not isinstance(v, str) for k,v in value.items()):
        raise JournalRefusal('Saved/fingerprint values must be exact string fields')
    return dict(value)

def journal_acknowledge(job, step, saved):
    job.acknowledge(step,journal_values(saved))

def journal_acknowledged(job, step):
    return job.acknowledged(step)

def journal_begin(job, step, method, path, request_fingerprint):
    return job.begin(step,method,path,request_fingerprint)

def journal_fingerprint(value):
    return fingerprint(journal_values(value))

def journal_saved(job, step):
    return job.saved(step)

def not_value(value):
    if not isinstance(value, bool): raise RuntimeError("Expected a Boolean")
    return not value

def open_journal(path, base, workspace, slug, job, input_fingerprint, writes, mode):
    return Journal(path,base,workspace,slug,job,input_fingerprint,writes,mode)

def optional(name, fallback):
    value = os.environ.get(name)
    return fallback if value is None or value == "" else value

def positive_id(value):
    if not re.fullmatch(r"[1-9][0-9]*", value) or int(value) > 9223372036854775807: raise RuntimeError("Use a positive record ID")
    return value

def print_value(value):
    print(value if isinstance(value, str) else json.dumps(value, ensure_ascii=False))

def require_condition(value, message):
    if value is not True: raise RuntimeError(message)

def required(name):
    value = os.environ.get(name)
    if value is None or not value.strip(): raise RuntimeError("Set " + name)
    return value

def response_status(value):
    return str(value["status"])

def text(value):
    if value is None: return ""
    if isinstance(value, str): return value
    if isinstance(value, bool): return "true" if value else "false"
    if isinstance(value, int): return str(value)
    raise RuntimeError("Expected a scalar response value")


def main():
    results_event_id = positive_id(required("EXHIBITDAY_EVENT_ID"))
    results_objective_id = positive_id(required("EXHIBITDAY_OBJECTIVE_ID"))
    results_lead_count = bounded_whole_number(required("EXHIBITDAY_LEAD_COUNT"), "EXHIBITDAY_LEAD_COUNT", "9223372036854775807")
    results_rating = bounded_whole_number(required("EXHIBITDAY_ACHIEVEMENT_RATING"), "EXHIBITDAY_ACHIEVEMENT_RATING", "10")
    results_journal_path = required("EXHIBITDAY_JOURNAL")
    results_job_id = required("EXHIBITDAY_JOB_ID")
    results_job_mode = optional("EXHIBITDAY_JOB_MODE", "resume")
    results_workspace_response = call("workspace_binding", {}, None, None)
    require_condition(equal(response_status(results_workspace_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
    results_workspace = results_workspace_response["body"]
    results_workspace_id = positive_id(text(field(results_workspace, "id")))
    results_event_response = call("read_event", {"id": results_event_id, "$include_record_revision": "true"}, None, None)
    require_condition(equal(response_status(results_event_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
    results_event = results_event_response["body"]
    require_condition(equal(text(field(results_event, "id")), results_event_id), "Read the exact selected Event before recording results.")
    results_leads_revision = text(field(results_event, "record_revision"))
    require_condition(is_present(results_leads_revision), "The Event read needs its own actual record_revision.")
    results_objective_response = call("read_objective", {"id": results_objective_id, "$include_record_revision": "true"}, None, None)
    require_condition(equal(response_status(results_objective_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
    results_objective = results_objective_response["body"]
    require_condition(both(equal(text(field(results_objective, "id")), results_objective_id), equal(text(field(results_objective, "event_id")), results_event_id)), "The Objective does not belong to the selected Event; no write was sent.")
    results_objective_revision = text(field(results_objective, "record_revision"))
    require_condition(is_present(results_objective_revision), "The Objective read needs its own actual record_revision.")
    results_input_fingerprint = journal_fingerprint({"workflow_contract_sha256": "94A1426B8C4D275633E918271BB2A2683E06A442317C472320B2E446E00ABCF6", "event_id": results_event_id, "objective_id": results_objective_id, "roi_num_leads": results_lead_count, "achievement_rating": results_rating})
    results_job = open_journal(results_journal_path, "https://api.exhibitday.com/v1", results_workspace_id, "show-results-objectives", results_job_id, results_input_fingerprint, [["save_leads", "PATCH", "/v1/events"], ["rate_objective", "PATCH", "/v1/events/objectives"]], results_job_mode)
    try:
        require_condition(either(not_value(journal_acknowledged(results_job, "rate_objective")), journal_acknowledged(results_job, "save_leads")), "A future results step is acknowledged before its prerequisite. Stop and reconcile the journal.")
        if journal_acknowledged(results_job, "save_leads"):
            results_leads_saved = journal_saved(results_job, "save_leads")
            require_condition(both(equal(text(field(results_leads_saved, "id")), results_event_id), equal(text(field(results_leads_saved, "roi_num_leads")), results_lead_count)), "Acknowledged results state does not match the selected record and intended value; stop and reconcile.")
        else:
            results_leads_patch = {"id": results_event_id, "roi_num_leads": results_lead_count, "expected_revision": results_leads_revision}
            results_leads_fingerprint = journal_fingerprint({"id": results_event_id, "roi_num_leads": results_lead_count, "expected_revision": results_leads_revision})
            journal_begin(results_job, "save_leads", "PATCH", "/v1/events", results_leads_fingerprint)
            results_leads_save_response = call("save_leads", {}, results_leads_patch, None)
            require_condition(equal(response_status(results_leads_save_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
            results_leads_receipt = results_leads_save_response["body"]
            results_leads_after_revision = text(field(results_leads_receipt, "record_revision"))
            require_condition(is_present(results_leads_after_revision), "A checked save acknowledgement requires its own returned record_revision.")
            journal_acknowledge(results_job, "save_leads", {"id": results_event_id, "roi_num_leads": results_lead_count, "record_revision": results_leads_after_revision})
        if journal_acknowledged(results_job, "rate_objective"):
            results_objective_saved = journal_saved(results_job, "rate_objective")
            require_condition(both(both(equal(text(field(results_objective_saved, "id")), results_objective_id), equal(text(field(results_objective_saved, "achievement_rating")), results_rating)), equal(text(field(results_objective_saved, "event_id")), results_event_id)), "Acknowledged results state does not match the selected record and intended value; stop and reconcile.")
        else:
            results_objective_patch = {"id": results_objective_id, "achievement_rating": results_rating, "expected_revision": results_objective_revision}
            results_objective_fingerprint = journal_fingerprint({"id": results_objective_id, "achievement_rating": results_rating, "expected_revision": results_objective_revision})
            journal_begin(results_job, "rate_objective", "PATCH", "/v1/events/objectives", results_objective_fingerprint)
            results_objective_save_response = call("rate_objective", {}, results_objective_patch, None)
            require_condition(equal(response_status(results_objective_save_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
            results_objective_receipt = results_objective_save_response["body"]
            results_objective_after_revision = text(field(results_objective_receipt, "record_revision"))
            require_condition(is_present(results_objective_after_revision), "A checked save acknowledgement requires its own returned record_revision.")
            journal_acknowledge(results_job, "rate_objective", {"id": results_objective_id, "achievement_rating": results_rating, "record_revision": results_objective_after_revision, "event_id": results_event_id})
        results_event_verify_response = call("verify_event", {"id": results_event_id}, None, None)
        require_condition(equal(response_status(results_event_verify_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
        results_event_verified = results_event_verify_response["body"]
        require_condition(both(equal(text(field(results_event_verified, "id")), results_event_id), equal(text(field(results_event_verified, "roi_num_leads")), results_lead_count)), "The final Event no longer has the acknowledged leads value; inspect it instead of automatically restoring it.")
        results_objective_verify_response = call("verify_objective", {"id": results_objective_id}, None, None)
        require_condition(equal(response_status(results_objective_verify_response), "200"), "Expected the endpoint's documented HTTP200 acknowledgement. Preserve pending state and reconcile any other outcome.")
        results_objective_verified = results_objective_verify_response["body"]
        require_condition(both(equal(text(field(results_objective_verified, "id")), results_objective_id), both(equal(text(field(results_objective_verified, "event_id")), results_event_id), equal(text(field(results_objective_verified, "achievement_rating")), results_rating))), "The final Objective is missing, rebound or has another rating; earlier saved steps remain in the journal.")
        print_value({"event_id": results_event_id, "objective_id": results_objective_id, "roi_num_leads": results_lead_count, "achievement_rating": results_rating})
    finally:
        results_job.close()


if __name__ == "__main__":
    main()

EXHIBITDAY_PY

Example response

{
  "id": 8001,
  "event_id": 5001,
  "event_name": "Spring Expo 2030",
  "objective_type_id": 1,
  "objective_type": "Lead Generation",
  "name": "Lead Generation",
  "importance_id": 2,
  "importance": "Medium",
  "achievement_rating": 8,
  "objective_created_timestamp": "2030-01-03T14:30:00Z"
}
Note: The Objective as read after the save. It shows achievement rating 8. The Event read before it already showed 48 leads.

Things to keep in mind

  • An achievement rating is a whole number from 0 through 10.
  • ExhibitDay calculates the read-only ROO score from rated Objectives and their importance.
  • Other Objectives can affect the score. It can be null if the score cannot be calculated or the key cannot read ROI results.

If a run stops

  • Keep the journal private. It records what the program tried to save and which save it confirmed.
  • To continue a run with no unresolved save, use EXHIBITDAY_JOB_MODE=resume with the same job ID, journal path and inputs.
  • A resumed run skips acknowledged saves. It stops if an Objective save is recorded without the lead count save.
  • If a save stops with a conflict, a lost response or a missing revision, check the Event and Objective in ExhibitDay before running the program again.
  • If you still need a change after checking the old run, use EXHIBITDAY_JOB_MODE=new with a new job ID and journal path.
  • Run only one copy per journal.
  • If a crash leaves a .lock file, make sure no copy using that journal is running or can start. Then remove the lock file and keep the journal.