Create a scorecard
POST/v1/blueprints/:blueprint_identifier/scorecards
This route allows you to create a scorecard for a given blueprint. A scorecard is a set of rules that define the quality of a blueprint.
To learn more about scorecards, check out the documentation.
Request
Parameters (JSON)
{
"parameters": [
{
"schema": {
"type": "boolean",
"default": false
},
"in": "query",
"name": "includeAdditionalProperties",
"required": false,
"description": "If true, the response includes the additional `properties` and `relations` set on the scorecard entity."
},
{
"schema": {
"type": "string",
"minLength": 1
},
"in": "path",
"name": "blueprint_identifier",
"required": true,
"description": "The identifier of the blueprint to operate on."
}
]
}Request body schema (JSON)
{
"title": "Body",
"body": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"identifier": {
"type": "string",
"pattern": "^(?!\\.{1,2}$)[\\p{L}0-9@_.+:\\\\/='-]+$",
"maxLength": 100,
"description": "A unique identifier for the scorecard."
},
"title": {
"type": "string",
"description": "The title of the scorecard."
},
"filter": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
],
"description": "The combinator to use when evaluating the conditions."
},
"conditions": {
"type": "array",
"minItems": 1,
"description": "The conditions to evaluate.",
"items": {
"anyOf": [
{
"type": "object",
"title": "Property between condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"enum": [
"between",
"notBetween",
"="
]
},
"value": {
"type": "object",
"oneOf": [
{
"type": "object",
"title": "Date range",
"properties": {
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
},
"required": [
"from",
"to"
]
},
{
"type": "object",
"title": "Preset date range",
"properties": {
"preset": {
"type": "string",
"enum": [
"today",
"tomorrow",
"yesterday",
"lastWeek",
"last2Weeks",
"lastMonth",
"last3Months",
"last6Months",
"last12Months"
]
}
},
"required": [
"preset"
]
}
]
}
},
"required": [
"property",
"operator",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"title": "Property containsAny condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation containsAny condition",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property comparison",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation comparison",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property empty condition",
"properties": {
"not": {
"type": "boolean"
},
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"property",
"operator"
]
},
{
"type": "object",
"title": "Relation empty condition",
"properties": {
"not": {
"type": "boolean"
},
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"relation",
"operator"
]
}
]
}
}
},
"required": [
"combinator",
"conditions"
],
"description": "An optional set of [conditions](https://docs.port.io/governance/standards-and-compliance/concepts-and-structure/#conditions) to filter entities that will be evaluated by the scorecard."
},
"properties": {
"type": "object",
"propertyNames": {
"pattern": "^[A-Za-z0-9@_=\\\\-]+$"
},
"description": "An object containing the additional properties of the scorecard, in `\"key\":\"value\"` pairs where the `key` is the property's identifier, and the `value` is its value. Property keys must match custom properties you added to the `_scorecard` blueprint. On PUT, omitted keys are cleared; omit the field or pass `{}` to clear all additional properties. To learn more, see [extend the default scorecards](https://docs.port.io/governance/standards-and-compliance/examples/extend-data-model/)."
},
"relations": {
"type": "object",
"propertyNames": {
"pattern": "^[A-Za-z0-9@_=\\\\-]+$",
"not": {
"enum": [
"group"
]
}
},
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
},
"description": "An object containing the additional relations of the scorecard, in `\"key\":\"value\"` pairs where the `key` is the relation's identifier, and the `value` is the related entity identifier (or an array of identifiers). Relation keys must match custom relations you added to the `_scorecard` blueprint. The `group` relation is managed by Port and cannot be set here. On PUT, omitted keys are cleared; omit the field or pass `{}` to clear all additional relations. You can also pass `null` to clear a specific relation. To learn more, see [extend the default scorecards](https://docs.port.io/governance/standards-and-compliance/examples/extend-data-model/)."
},
"rules": {
"type": "array",
"description": "The [rules](https://docs.port.io/governance/standards-and-compliance/concepts-and-structure/#rule-elements) that define the scorecard.",
"items": {
"type": "object",
"properties": {
"identifier": {
"type": "string",
"pattern": "^[A-Za-z0-9@_=\\\\-]+$",
"maxLength": 100,
"description": "The identifier of the rule."
},
"title": {
"type": "string",
"description": "The title of the rule."
},
"description": {
"type": "string",
"description": "A description for the rule."
},
"level": {
"type": "string",
"description": "The level of the rule (Gold, Silver, or Bronze)."
},
"query": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
],
"description": "The combinator to use when evaluating the conditions."
},
"conditions": {
"type": "array",
"minItems": 1,
"description": "The conditions to evaluate.",
"items": {
"anyOf": [
{
"type": "object",
"title": "Property between condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"enum": [
"between",
"notBetween",
"="
]
},
"value": {
"type": "object",
"oneOf": [
{
"type": "object",
"title": "Date range",
"properties": {
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
},
"required": [
"from",
"to"
]
},
{
"type": "object",
"title": "Preset date range",
"properties": {
"preset": {
"type": "string",
"enum": [
"today",
"tomorrow",
"yesterday",
"lastWeek",
"last2Weeks",
"lastMonth",
"last3Months",
"last6Months",
"last12Months"
]
}
},
"required": [
"preset"
]
}
]
}
},
"required": [
"property",
"operator",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"title": "Property containsAny condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation containsAny condition",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property comparison",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation comparison",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property empty condition",
"properties": {
"not": {
"type": "boolean"
},
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"property",
"operator"
]
},
{
"type": "object",
"title": "Relation empty condition",
"properties": {
"not": {
"type": "boolean"
},
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"relation",
"operator"
]
}
]
}
}
},
"required": [
"combinator",
"conditions"
],
"description": "The query that defines the rule."
}
},
"required": [
"identifier",
"title",
"level",
"query"
]
}
},
"levels": {
"type": "array",
"description": "The available levels of the scorecard, each with its own name and color.",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The name of the level."
},
"color": {
"type": "string",
"enum": [
"blue",
"turquoise",
"orange",
"purple",
"pink",
"yellow",
"green",
"red",
"gold",
"silver",
"paleBlue",
"darkGray",
"lightGray",
"bronze",
"lime",
"olive",
"brown"
],
"description": "The color associated with the level, for visualization in Port's UI."
}
},
"required": [
"title",
"color"
]
}
}
},
"if": {
"properties": {
"levels": {
"type": "array",
"minItems": 1
}
}
},
"then": {
"properties": {
"rules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"identifier": {
"type": "string",
"pattern": "^(?!\\.{1,2}$)[\\p{L}0-9@_.+:\\\\/='-]+$",
"maxLength": 100
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"level": {
"type": "string"
},
"query": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
],
"description": "The combinator to use when evaluating the conditions."
},
"conditions": {
"type": "array",
"minItems": 1,
"description": "The conditions to evaluate.",
"items": {
"anyOf": [
{
"type": "object",
"title": "Property between condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"enum": [
"between",
"notBetween",
"="
]
},
"value": {
"type": "object",
"oneOf": [
{
"type": "object",
"title": "Date range",
"properties": {
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
},
"required": [
"from",
"to"
]
},
{
"type": "object",
"title": "Preset date range",
"properties": {
"preset": {
"type": "string",
"enum": [
"today",
"tomorrow",
"yesterday",
"lastWeek",
"last2Weeks",
"lastMonth",
"last3Months",
"last6Months",
"last12Months"
]
}
},
"required": [
"preset"
]
}
]
}
},
"required": [
"property",
"operator",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"title": "Property containsAny condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation containsAny condition",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property comparison",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation comparison",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property empty condition",
"properties": {
"not": {
"type": "boolean"
},
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"property",
"operator"
]
},
{
"type": "object",
"title": "Relation empty condition",
"properties": {
"not": {
"type": "boolean"
},
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"relation",
"operator"
]
}
]
}
}
},
"required": [
"combinator",
"conditions"
]
}
},
"required": [
"identifier",
"title",
"query"
]
}
}
}
},
"else": {
"properties": {
"rules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"identifier": {
"type": "string",
"pattern": "^(?!\\.{1,2}$)[\\p{L}0-9@_.+:\\\\/='-]+$",
"maxLength": 100
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"level": {
"type": "string",
"enum": [
"Gold",
"Silver",
"Bronze"
]
},
"query": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
],
"description": "The combinator to use when evaluating the conditions."
},
"conditions": {
"type": "array",
"minItems": 1,
"description": "The conditions to evaluate.",
"items": {
"anyOf": [
{
"type": "object",
"title": "Property between condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"enum": [
"between",
"notBetween",
"="
]
},
"value": {
"type": "object",
"oneOf": [
{
"type": "object",
"title": "Date range",
"properties": {
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
},
"required": [
"from",
"to"
]
},
{
"type": "object",
"title": "Preset date range",
"properties": {
"preset": {
"type": "string",
"enum": [
"today",
"tomorrow",
"yesterday",
"lastWeek",
"last2Weeks",
"lastMonth",
"last3Months",
"last6Months",
"last12Months"
]
}
},
"required": [
"preset"
]
}
]
}
},
"required": [
"property",
"operator",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"title": "Property containsAny condition",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation containsAny condition",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"containsAny",
"in"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property comparison",
"properties": {
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"property",
"operator",
"value"
]
},
{
"type": "object",
"title": "Relation comparison",
"properties": {
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
">",
"<",
">=",
"<=",
"contains",
"doesNotContains",
"beginsWith",
"doesNotBeginsWith",
"endsWith",
"doesNotEndsWith"
]
},
"value": {
"oneOf": [
{
"type": "string",
"title": "string"
},
{
"type": "number",
"title": "number"
},
{
"type": "boolean",
"title": "boolean"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "The value to compare against."
}
},
"required": [
"relation",
"operator",
"value"
]
},
{
"type": "object",
"title": "Property empty condition",
"properties": {
"not": {
"type": "boolean"
},
"property": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"property",
"operator"
]
},
{
"type": "object",
"title": "Relation empty condition",
"properties": {
"not": {
"type": "boolean"
},
"relation": {
"type": "string"
},
"operator": {
"type": "string",
"enum": [
"isEmpty",
"isNotEmpty"
]
}
},
"required": [
"relation",
"operator"
]
}
]
}
}
},
"required": [
"combinator",
"conditions"
]
}
},
"required": [
"identifier",
"title",
"query"
]
}
}
}
},
"additionalProperties": false,
"required": [
"identifier",
"title",
"rules"
]
}
}
},
"required": true
}
}Responses
- 401
- 404
- 413
- 422
Default Response
A resource with the provided identifier was not found
Request body is too large (limit is 1MiB)
The json provided does not match the route's schema
Responses (JSON)
{
"responses": {
"401": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false
}
}
}
},
"404": {
"description": "A resource with the provided identifier was not found",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "A resource with the provided identifier was not found"
}
}
}
},
"413": {
"description": "Request body is too large (limit is 1MiB)",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false,
"description": "Request body is too large (limit is 1MiB)"
}
}
}
},
"422": {
"description": "The json provided does not match the route's schema",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "The json provided does not match the route's schema"
}
}
}
}
}
}