コンテンツにスキップ

HTTP API

このページは、エンジンのバージョン 0.16.0 のコードから生成しています。リリースとリリースの間は main のコードを表示するため、次のバージョンの変更がすでに入っていることがあります。

Pointsman の HTTP API です。どのリクエストにも、ヘッダー Authorization: Bearer <token> で API トークンを付けます。OpenAPI を読むツール向けの完全な定義は openapi.yaml にあります。

コードから取り込んだ説明文は英語のままです。

Get a decision from a profile.

パラメーター場所必須説明
profilepathはい
versionqueryいいえProfile version. The latest version when not given.
Idempotency-KeyheaderいいえA repeated request with the same key from the same client gets the decision already logged, when the request is the same (profile and version, state, ref, decisions); a different request with the same key is refused (409 idempotency_conflict). Ignored for test tokens, whose decisions are not logged.

リクエストボディ: DecideRequest(JSON)

ステータス説明ボディ
200The decisionDecision (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404ErrorError (application/json)
409resolved_by_person: the decision this one would replace was resolved by a person, and a person’s answer stays (docs/decision-chains.md). idempotency_conflict: the Idempotency-Key was used for a different request.Error (application/json)
500ErrorError (application/json)
502ErrorError (application/json)

Get a logged decision with its feedback.

パラメーター場所必須説明
idpathはい
ステータス説明ボディ
200The decision as loggedDecisionRecord (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
500ErrorError (application/json)

Correct the answers of a decision.

Corrections are checked against the profile version the decision used. A decision can get feedback more than once; all of it is kept.

パラメーター場所必須説明
idpathはい

リクエストボディ: FeedbackRequest(JSON)

ステータス説明ボディ
204Feedback stored
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
409The profile version of the decision is no longer available.Error (application/json)
500ErrorError (application/json)

What happened to a profile’s decisions in the last days.

Counts only, no single decisions or states: decisions per action, the review queue (pending, resolved, the final actions people chose), and decisions where a person corrected at least one answer. The window applies to when a decision was made; a later resolution or correction of such a decision counts with it.

パラメーター場所必須説明
profilepathはい
daysqueryいいえThe window, from 1 to 90 days back from now (default 7).
ステータス説明ボディ
200The countsProfileStats (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404Unknown profile.Error (application/json)
500ErrorError (application/json)

List decisions waiting for a human review.

Decisions with action review that are not resolved yet, oldest first (at most 100), for the profiles this token may use.

パラメーター場所必須説明
profilequeryいいえ
ステータス説明ボディ
200Pending reviewsobject (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile, or it is a test token (it may only decide).Error (application/json)
500ErrorError (application/json)

Resolve a pending review.

Sets the final action and answers. Answers in correct replace the model’s (source human); the others are kept (source model). correct is also stored as feedback. When the decision has a callback_url, the final answer is sent there (see “Callbacks”).

パラメーター場所必須説明
idpathはい

リクエストボディ: ResolveRequest(JSON)

ステータス説明ボディ
200ResolvedResolution (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, or one whose profile this token may not use.Error (application/json)
409The decision has no pending review (not a review, already resolved, or closed as superseded), or its profile version is gone.Error (application/json)
500ErrorError (application/json)

Close a pending review of your own decision.

The review leaves the queue as superseded, for example when the question it asks no longer applies (the GitHub connector closes the review of an older commit after a push). Only the client that made the decision may close it; for any other token the decision does not exist (404). No body. No callback is sent, and a later resolve gets 409 not_pending.

パラメーター場所必須説明
idpathはい
ステータス説明ボディ
200ClosedClosedReview (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403A test token, which may only decide.Error (application/json)
404Unknown decision, one whose profile this token may not use, or one another client made.Error (application/json)
409The decision has no pending review (not a review, already resolved, or closed).Error (application/json)
500ErrorError (application/json)

List the profiles this token may use, with their versions.

ステータス説明ボディ
200The profiles this token may use (all profiles for a token with scope *)object (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
500ErrorError (application/json)

The decision graph a profile belongs to, for DMN tools.

The profile, the profiles it requires and the ones that require it (docs/decision-chains.md), among the profiles this token may use, as a DMN decision requirements graph. Only the graph: no decision logic. With format=dmn, DMN 1.3 XML with DMNDI shapes, which DMN tools (bpmn.io dmn-js, Camunda Modeler, Apache KIE) open. Not for test tokens.

パラメーター場所必須説明
idpathはい
formatqueryいいえjson (the graph), dmn (DMN 1.3 XML with DMNDI) or svg (a small diagram in the style of the datamodels.jp diagrams).
langqueryいいえThe language of the svg diagram’s text.
ステータス説明ボディ
200The graphDecisionGraph (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile (also a test token).Error (application/json)
404ErrorError (application/json)
500ErrorError (application/json)

A profile in plain sentences.

The profile as plain sentences in English or Japanese, for the people who approve it (docs/profile-format.md#explain): which model answers, what it sees, the questions, facts and earlier decisions, and each rule as “If …, the action is …”. The rules are read with the engine’s own parser. A required profile out of this token’s scope is not named, and a rule that reads it is shown as written. Test tokens may use it too: it reads no decisions.

パラメーター場所必須説明
idpathはい
versionqueryいいえA published version; the latest when not given.
langqueryいいえ
formatqueryいいえjson (the parts), or text (Markdown, to show as it is).
ステータス説明ボディ
200The explanationProfileExplanation (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile.Error (application/json)
404ErrorError (application/json)
500ErrorError (application/json)

Try a changed policy on the logged decisions.

What a changed policy would have decided on the newest logged decisions of a published version (docs/profile-format.md#replay). Policy only: the logged answers and facts are used, no model is called, and questions, facts and requires must stay the same (send them to have them checked). Earlier decisions are read from the snapshot kept with each decision; a new rule that reads a value the snapshot did not keep is unknown there, and the decision is counted as inexact. The token must be allowed to use the profile and every profile it requires. Not for test tokens.

パラメーター場所必須説明
idpathはい

リクエストボディ: object(JSON)

ステータス説明ボディ
200The replayReplayResult (application/json)
400ErrorError (application/json)
401Missing, malformed, unknown or revoked token.Error (application/json)
403The token may not use this profile or a profile it requires (also a test token).Error (application/json)
404ErrorError (application/json)
409The draft’s questions, facts or requires differ from the version (not_policy_only).Error (application/json)
500ErrorError (application/json)
フィールド型必須説明
statestring | object | arrayはいWhat the model decides about: free text, or any JSON object or array. When the profile has an input mapping, this is the raw client payload the mapping reads from.
refstringいいえThe client’s reference for this decision, for example an issue id.
callback_urlstringいいえWhere to send the final answer after a human review (https only).
decisionsobjectいいえFor a profile with requires (docs/decision-chains.md): the ids of the earlier decisions, by the names in requires. They are read from the decision log and must be of the named profile, in the token’s scope, with this request’s ref (then required) and from the same client; every other case gives the same 400. An optional one that was made for an older decision than one given here is left out (it is missing from requires in the answer). Not for test tokens.

A profile in plain sentences (docs/profile-format.md#explain).

フィールド型必須説明
profilestringはい
versionintegerはい
lang“en” | “ja”はい
titlestringはい
descriptionstringはい
modelstringはいWhich model answers
inputstringはいWhat the model sees of the request.
questionsstring[]はい
factsstring[]はい
requiresstring[]はい
rulesobject[]はいIn order; the first rule that matches gives the action.
orderstringはいHow the rules are checked.
defaultstringはいThe action when no rule matches
peoplestring[]はいWhich actions a person checks
notesstring[]はい

A changed policy replayed on logged decisions (docs/profile-format.md#replay).

フィールド型必須説明
profilestringはい
versionintegerはいThe version whose decisions were replayed.
replayedintegerはいDecisions replayed exactly; all other numbers count only these.
fromstring | nullはいThe oldest replayed decision.
tostring | nullはいThe newest replayed decision.
inexactintegerはいDecisions not replayed because a new rule reads a value of an earlier decision that was not kept.
skippedintegerはいDecisions not replayed because an answer the new rules read is not in the log.
changedintegerはいDecisions whose action would change.
actionsobjectはい
transitionsobject[]はい
peopleobjectはい
changesobject[]はいUp to 50 changed decisions, newest first.
フィールド型必須説明
actionstringはい
ruleinteger | nullはい

A DMN decision requirements graph; node and edge types are DMN’s names.

フィールド型必須説明
profilestringはいThe profile the graph was asked for.
nodesobject[]はい
edgesobject[]はい

What the rules read from one required decision, when this decision was made.

フィールド型必須説明
decisionstringはい
profilestringはい
profile_versionintegerはい
actionstringはい
outcomestringはいThe person’s answer when a review was resolved
reviewedbooleanはい
readobjectはいEvery value the rules read from it, by path; null = unknown.

A required decision of a profile the reader may not see.

フィールド型必須説明
decisionnullはい
フィールド型必須説明
decision_idstringはい
refstringいいえ
answersobjectはいOne answer per question, keyed by question name.
actionstringはいauto, review, or a custom action defined by the profile.
profilestringはい
profile_versionintegerはい
modelstringはいThe model that answered.
created_atstringはいWhen the decision was made.
ruleinteger | nullはいIndex of the policy rule that matched (from 0); null when the default action applied.
factsFactsいいえOnly for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.
testtrueいいえPresent (true) only for a test token’s decision, which is not logged.
requiresobjectいいえFor a profile with requires, by name. A required decision of a profile the token may no longer use is hidden.
replacesstringいいえThe earlier decision of the same profile, ref and client that this one replaces.
reviewobjectいいえPresent when a person checks the decision before it counts (the profile’s people_check).
versionsVersionsいいえThe engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.

The engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.

フィールド型必須説明
enginestringはい
modulesobjectはいModule name to version, for example “@pointsman/github”.
フィールド型必須説明
profilestringはい
daysintegerはい
sincestringはいDecisions made at or after this time are counted.
decisionsintegerはい
actionsobjectはいDecisions per action.
reviewsobjectはい
correctedintegerはいDecisions where a person corrected at least one answer (as in docs/accuracy.sql).

型: openapi.yaml を参照

フィールド型必須説明
decision_idstringはい
created_atstringはい
clientstringはいThe client whose token made the decision.
refstringいいえ
profilestringはい
profile_versionintegerはい
modelstringはい
actionstringはい
ruleinteger | nullはいIndex of the policy rule that matched; null when the default action applied.
answersobjectはい
factsFactsいいえOnly for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.
state_hashstringはいSHA-256 of the state sent to the model (keys sorted).
stateいいえThe state sent to the model. Only when the profile sets log.store_state.
reviewReviewいいえOnly for decisions whose action a person checks (the profile’s people_check; default review).
requiresobjectいいえFor a profile with requires, by name. A required decision of a profile the reader may not see is hidden.
idempotency_keystringいいえThe Idempotency-Key the decision was made with.
replacesstringいいえThe earlier decision of the same profile
versionsVersionsいいえThe engine version and the fact modules that answered the decision’s facts, with their versions (docs/modules.md). Missing for decisions made before fact modules.
discarded_atstringいいえMade while a person resolved the decision it would replace; the client got 409 resolved_by_person and it never counts.

Only for decisions whose action a person checks (the profile’s people_check; default review).

フィールド型必須説明
status“pending” | “resolved” | “superseded”はいsuperseded: a newer decision replaced this one while the review was open, or the client that made it closed the review.
resolved_atstringいいえ
resolved_bystringいいえ
final_actionstringいいえ
final_answersFinalAnswersいいえ

型: object

Delivery of the final answer to the decision’s callback_url.

フィールド型必須説明
status“pending” | “delivered” | “failed”はい
attemptsintegerはい
last_errorstringいいえ
next_atstringいいえ
フィールド型必須説明
actionstringはいThe final action, e.g. auto; not review.
correctobjectいいえCorrected answers by question name (as in feedback). Empty or left out to keep the model’s answers.
bystringはい
notestringいいえ
フィールド型必須説明
decision_idstringはい
actionstringはい
answersFinalAnswersはい
resolved_bystringはい
resolved_atstringはい
callback“pending” | “none”はいpending when the final answer will be sent to the callback_url.
フィールド型必須説明
decision_idstringはい
reviewobjectはい
フィールド型必須説明
correctobjectはいCorrected values by question name: true/false (noul), an option (choice), a level (score).
bystringはいWho made the correction.
notestringいいえ
フィールド型必須説明
created_atstringはい
clientstringはい
bystringはい
correctobjectはい
notestringいいえ

Only for profiles with facts (docs/profile-format.md#facts): each fact the profile asked for, by name, as looked up for this decision, or why it is missing. A rule that needs a missing fact does not match.

型: object | object

型: NoulAnswer | ChoiceAnswer | ScoreAnswer

フィールド型必須説明
type“noul”はい
valuebooleanはいtrue when P(yes) >= 0.5
pProbabilityはい
yesProbabilityはい
フィールド型必須説明
type“choice”はい
valuestringはいThe most likely option.
pProbabilityはい
probabilitiesProbabilitiesはい
フィールド型必須説明
type“score”はい
valueintegerはいThe most likely level
pProbabilityはい
scorenumberはいProbability-weighted level; can fall between levels.
probabilitiesProbabilitiesはいProbability per level, keyed by level index.

型: number

型: object

フィールド型必須説明
idstringはい
versionintegerはいLatest version.
versionsinteger[]はい
titleBilingualTextはい
descriptionBilingualTextはい
requiresstring[]いいえThe profile ids the latest version requires (decision chains, docs/decision-chains.md).
フィールド型必須説明
enstringはい
jastringはい
フィールド型必須説明
errorobjectはい

Geolonia のオープンソースプロジェクト · このサイトについて