diff --git a/PostmanCollections/VTEX - Policies System API.json b/PostmanCollections/VTEX - Policies System API.json index 33825b6a0..4e89d31de 100644 --- a/PostmanCollections/VTEX - Policies System API.json +++ b/PostmanCollections/VTEX - Policies System API.json @@ -1,10 +1,10 @@ { "_": { - "postman_id": "1c6db4dc-aa94-413a-9ff0-6df857b177a1" + "postman_id": "bc0e3c08-b3b5-4724-81a3-6a2c2b75133a" }, "item": [ { - "id": "c7e23ad0-0a3a-4fd1-9262-fb8ea7c36a82", + "id": "34b11455-bc29-4ea1-ac5b-35a46b8159cf", "name": "Policy", "description": { "content": "", @@ -12,7 +12,7 @@ }, "item": [ { - "id": "48e90c1c-7de4-4cac-aa7c-7e5ad5c8e824", + "id": "767bd0cc-f7b0-4d0a-a9c9-f739db9736fc", "name": "Get policy list", "request": { "name": "Get policy list", @@ -30,26 +30,7 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ { @@ -69,16 +50,21 @@ }, "key": "Accept", "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" } ], - "method": "GET" + "method": "GET", + "body": {} }, "response": [ { "_": { "postman_previewlanguage": "json" }, - "id": "e6896217-4fbd-4f3e-b550-f043eae0ef49", + "id": "e2b16795-bd08-4e37-b918-199953895505", "name": "OK", "originalRequest": { "url": { @@ -91,36 +77,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -142,6 +101,14 @@ { "key": "Accept", "value": "application/json" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "GET", @@ -163,13 +130,13 @@ { "listen": "test", "script": { - "id": "8770bbb1-c1a5-429f-aa5b-27ea9e7e5391", + "id": "9f4063fa-7dd3-4648-bc70-303136af458a", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[GET]::/api/policy-engine/policies - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n", "// Validate if response header has matching content-type\npm.test(\"[GET]::/api/policy-engine/policies - Content-Type is application/json\", function () {\n pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\n});\n", "// Validate if response has JSON Body \npm.test(\"[GET]::/api/policy-engine/policies - Response has JSON Body\", function () {\n pm.response.to.have.jsonBody();\n});\n", - "// Response Validation\nconst schema = {\"type\":\"array\",\"items\":{\"title\":\"PolicyGetResponse\",\"description\":\"Object with policy information.\",\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Policy ID.\"},\"name\":{\"type\":\"string\",\"description\":\"Policy name.\",\"title\":\"name\"},\"description\":{\"type\":\"string\",\"description\":\"Policy description, only for internal use.\",\"title\":\"description\"},\"statements\":{\"type\":\"array\",\"title\":\"statements\",\"items\":{\"type\":\"object\",\"description\":\"Object with policy conditions.\",\"required\":[\"effect\"],\"properties\":{\"effect\":{\"type\":\"string\",\"title\":\"effect\",\"description\":\"This field is not functional at the moment. To create a correct request, fill the field with `Allow`.\",\"example\":\"Allow\",\"deprecated\":true},\"actions\":{\"type\":\"array\",\"title\":\"actions\",\"items\":{\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Action ID.\",\"example\":\"SendSlackMessage\",\"enum\":[\"SendSlackMessage\",\"SendEmail\",\"DeactivatePromotions\"]},\"metadata\":{\"type\":\"object\",\"title\":\"metadata\",\"description\":\"Data inside of the actions.\",\"additionalProperties\":true}},\"type\":\"object\",\"description\":\"Array with actions information.\"},\"description\":\"Actions that the policy will execute.\"},\"resource\":{\"type\":\"string\",\"description\":\"Scope on which this policy must be evaluated.\",\"title\":\"resource\",\"example\":\"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\"},\"condition\":{\"type\":\"object\",\"properties\":{\"conditions\":{\"type\":\"array\",\"description\":\"List of conditions that will activate the policy.\",\"items\":{\"description\":\"List of conditions that will activate the policy.\",\"type\":\"object\",\"properties\":{\"conditions\":{\"title\":\"conditions\",\"type\":\"array\",\"description\":\"List of conditions the actions can have. It can be an empty array `[]`.\",\"enum\":[[],[\"stringEquals\"],[\"numericGreaterThan\"]],\"items\":{\"type\":\"string\",\"description\":\"Condition value.\",\"example\":\"None\"}},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"The action of the condition.\",\"example\":\"None\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"key\":{\"type\":\"string\",\"title\":\"key\",\"description\":\"The element that will define what the policy will influence.\",\"example\":\"skuId\",\"enum\":[\"skuId\",\"brandId\",\"discountPercentage\"]},\"values\":{\"type\":\"array\",\"title\":\"values\",\"items\":{\"type\":\"string\",\"description\":\"Key value.\",\"example\":\"40.00\"},\"description\":\"Array with values of the key.\"}}}}},\"description\":\"Condition to activate this policy. This object can have a maximum of ten recursive conditions.\",\"title\":\"condition\"},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"This operation will determine if all the conditions need to be valid or at least one of them, if the conditions array is not empty.\",\"example\":\"None\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]}}},\"description\":\"Requirements for the policy to be applied.\"}}},\"description\":\"Array of objects with policies infomation.\"}\n\n// Validate if response matches JSON schema \npm.test(\"[GET]::/api/policy-engine/policies - Schema is valid\", function() {\n pm.response.to.have.jsonSchema(schema,{unknownFormats: [\"int32\", \"int64\", \"float\", \"double\"]});\n});\n" + "// Response Validation\nconst schema = {\"type\":\"array\",\"items\":{\"title\":\"PolicyGetResponse\",\"description\":\"Object with policy information.\",\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Policy ID.\"},\"name\":{\"type\":\"string\",\"description\":\"Policy name.\",\"title\":\"name\"},\"description\":{\"type\":\"string\",\"description\":\"Policy description, only for internal use.\",\"title\":\"description\"},\"statements\":{\"type\":\"array\",\"title\":\"statements\",\"items\":{\"type\":\"object\",\"description\":\"Object with policy conditions.\",\"required\":[\"effect\"],\"properties\":{\"effect\":{\"type\":\"string\",\"title\":\"effect\",\"description\":\"This field is not functional at the moment. To create a correct request, fill the field with `Allow`.\"},\"actions\":{\"type\":\"array\",\"title\":\"actions\",\"items\":{\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Action ID.\",\"enum\":[\"SendSlackMessage\",\"SendEmail\",\"DeactivatePromotions\"]},\"metadata\":{\"type\":\"object\",\"title\":\"metadata\",\"description\":\"Data inside of the actions.\",\"additionalProperties\":true}},\"type\":\"object\",\"description\":\"Array with actions information.\"},\"description\":\"Actions that the policy will execute.\"},\"resource\":{\"type\":\"string\",\"description\":\"Scope on which this policy must be evaluated.\",\"title\":\"resource\"},\"condition\":{\"type\":\"object\",\"properties\":{\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"This operation will determine if all the conditions need to be valid or at least one of them, if the conditions array is not empty.\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"conditions\":{\"type\":\"array\",\"description\":\"List of conditions that will activate the policy.\",\"items\":{\"description\":\"List of conditions that will activate the policy.\",\"type\":\"object\",\"properties\":{\"conditions\":{\"title\":\"conditions\",\"type\":\"array\",\"description\":\"List of conditions the actions can have. It can be an empty array `[]`.\",\"enum\":[[],[\"stringEquals\"],[\"numericGreaterThan\"]],\"items\":{\"type\":\"string\",\"description\":\"Condition value.\"}},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"The action of the condition.\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"key\":{\"type\":\"string\",\"title\":\"key\",\"description\":\"The element that will define what the policy will influence.\",\"enum\":[\"skuId\",\"brandId\",\"discountPercentage\"]},\"values\":{\"type\":\"array\",\"title\":\"values\",\"items\":{\"type\":\"string\",\"description\":\"Key value.\"},\"description\":\"Array with values of the key.\"}}}}},\"description\":\"Condition to activate this policy. This object can have a maximum of ten recursive conditions.\",\"title\":\"condition\"}}},\"description\":\"Requirements for the policy to be applied.\"}}},\"description\":\"Array of objects with policies infomation.\"}\n\n// Validate if response matches JSON schema \npm.test(\"[GET]::/api/policy-engine/policies - Schema is valid\", function() {\n pm.response.to.have.jsonSchema(schema,{unknownFormats: [\"int32\", \"int64\", \"float\", \"double\"]});\n});\n" ] } } @@ -179,7 +146,7 @@ } }, { - "id": "c322c101-b10e-4922-a7c8-0931e35d968c", + "id": "45ebd2a6-0822-44a5-aec2-de2eb17f5ba1", "name": "Evaluate policies", "request": { "name": "Evaluate policies", @@ -197,26 +164,7 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ { @@ -236,6 +184,14 @@ }, "key": "Accept", "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" } ], "method": "POST", @@ -244,6 +200,7 @@ "raw": "{\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"context\": {\n \"brandId\": \"2000001\",\n \"discountPercentage\": \"91.00\"\n }\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -254,7 +211,7 @@ "_": { "postman_previewlanguage": "json" }, - "id": "6abbe468-fbcb-469e-a19e-215e7eb8e5d5", + "id": "f1031559-776a-48b6-a2bd-30e70ab4dd76", "name": "OK", "originalRequest": { "url": { @@ -267,36 +224,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -315,9 +245,21 @@ "key": "Accept", "value": "application/json" }, + { + "key": "Content-Type", + "value": "application/json" + }, { "key": "Accept", "value": "application/json" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "POST", @@ -326,6 +268,7 @@ "raw": "{\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"context\": {\n \"brandId\": \"2000001\",\n \"discountPercentage\": \"91.00\"\n }\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -347,7 +290,7 @@ { "listen": "test", "script": { - "id": "11022d59-d42a-422c-baaa-73a5a8d61a4c", + "id": "c0b04898-9c00-4b69-8454-3546d7847930", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[POST]::/api/policy-engine/evaluate - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n", @@ -363,7 +306,7 @@ } }, { - "id": "43b44a9b-4a43-451e-8604-a9873b01af1e", + "id": "7400e44d-feda-4ecb-9fd0-173fbecca75c", "name": "Get policy by ID", "request": { "name": "Get policy by ID", @@ -392,24 +335,6 @@ "type": "any", "value": "pa_test_001", "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" } ] }, @@ -431,16 +356,21 @@ }, "key": "Accept", "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" } ], - "method": "GET" + "method": "GET", + "body": {} }, "response": [ { "_": { "postman_previewlanguage": "json" }, - "id": "0b3d4af4-bfb6-4082-aac9-2a1832fae741", + "id": "7a15b1c2-16ff-49ab-bd5a-a354b78af94a", "name": "OK", "originalRequest": { "url": { @@ -454,46 +384,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "disabled": false, - "description": { - "content": "(Required) Policy ID.", - "type": "text/plain" - }, - "type": "any", - "value": "pa_test_001", - "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -515,6 +408,14 @@ { "key": "Accept", "value": "application/json" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "GET", @@ -536,13 +437,13 @@ { "listen": "test", "script": { - "id": "674fcfe4-f57a-4132-87fc-206cd9eca018", + "id": "52eb7e33-efd8-41e6-b1cb-f9bdd9f5d579", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[GET]::/api/policy-engine/policies/:id - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n", "// Validate if response header has matching content-type\npm.test(\"[GET]::/api/policy-engine/policies/:id - Content-Type is application/json\", function () {\n pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\n});\n", "// Validate if response has JSON Body \npm.test(\"[GET]::/api/policy-engine/policies/:id - Response has JSON Body\", function () {\n pm.response.to.have.jsonBody();\n});\n", - "// Response Validation\nconst schema = {\"type\":\"array\",\"items\":{\"title\":\"PolicyGetResponse\",\"description\":\"Object with policy information.\",\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Policy ID.\"},\"name\":{\"type\":\"string\",\"description\":\"Policy name.\",\"title\":\"name\"},\"description\":{\"type\":\"string\",\"description\":\"Policy description, only for internal use.\",\"title\":\"description\"},\"statements\":{\"type\":\"array\",\"title\":\"statements\",\"items\":{\"type\":\"object\",\"description\":\"Object with policy conditions.\",\"required\":[\"effect\"],\"properties\":{\"effect\":{\"type\":\"string\",\"title\":\"effect\",\"description\":\"This field is not functional at the moment. To create a correct request, fill the field with `Allow`.\",\"example\":\"Allow\",\"deprecated\":true},\"actions\":{\"type\":\"array\",\"title\":\"actions\",\"items\":{\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Action ID.\",\"example\":\"SendSlackMessage\",\"enum\":[\"SendSlackMessage\",\"SendEmail\",\"DeactivatePromotions\"]},\"metadata\":{\"type\":\"object\",\"title\":\"metadata\",\"description\":\"Data inside of the actions.\",\"additionalProperties\":true}},\"type\":\"object\",\"description\":\"Array with actions information.\"},\"description\":\"Actions that the policy will execute.\"},\"resource\":{\"type\":\"string\",\"description\":\"Scope on which this policy must be evaluated.\",\"title\":\"resource\",\"example\":\"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\"},\"condition\":{\"type\":\"object\",\"properties\":{\"conditions\":{\"type\":\"array\",\"description\":\"List of conditions that will activate the policy.\",\"items\":{\"description\":\"List of conditions that will activate the policy.\",\"type\":\"object\",\"properties\":{\"conditions\":{\"title\":\"conditions\",\"type\":\"array\",\"description\":\"List of conditions the actions can have. It can be an empty array `[]`.\",\"enum\":[[],[\"stringEquals\"],[\"numericGreaterThan\"]],\"items\":{\"type\":\"string\",\"description\":\"Condition value.\",\"example\":\"None\"}},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"The action of the condition.\",\"example\":\"None\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"key\":{\"type\":\"string\",\"title\":\"key\",\"description\":\"The element that will define what the policy will influence.\",\"example\":\"skuId\",\"enum\":[\"skuId\",\"brandId\",\"discountPercentage\"]},\"values\":{\"type\":\"array\",\"title\":\"values\",\"items\":{\"type\":\"string\",\"description\":\"Key value.\",\"example\":\"40.00\"},\"description\":\"Array with values of the key.\"}}}}},\"description\":\"Condition to activate this policy. This object can have a maximum of ten recursive conditions.\",\"title\":\"condition\"},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"This operation will determine if all the conditions need to be valid or at least one of them, if the conditions array is not empty.\",\"example\":\"None\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]}}},\"description\":\"Requirements for the policy to be applied.\"}}},\"description\":\"Array of objects with policies infomation.\"}\n\n// Validate if response matches JSON schema \npm.test(\"[GET]::/api/policy-engine/policies/:id - Schema is valid\", function() {\n pm.response.to.have.jsonSchema(schema,{unknownFormats: [\"int32\", \"int64\", \"float\", \"double\"]});\n});\n" + "// Response Validation\nconst schema = {\"type\":\"array\",\"items\":{\"title\":\"PolicyGetResponse\",\"description\":\"Object with policy information.\",\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Policy ID.\"},\"name\":{\"type\":\"string\",\"description\":\"Policy name.\",\"title\":\"name\"},\"description\":{\"type\":\"string\",\"description\":\"Policy description, only for internal use.\",\"title\":\"description\"},\"statements\":{\"type\":\"array\",\"title\":\"statements\",\"items\":{\"type\":\"object\",\"description\":\"Object with policy conditions.\",\"required\":[\"effect\"],\"properties\":{\"effect\":{\"type\":\"string\",\"title\":\"effect\",\"description\":\"This field is not functional at the moment. To create a correct request, fill the field with `Allow`.\"},\"actions\":{\"type\":\"array\",\"title\":\"actions\",\"items\":{\"properties\":{\"id\":{\"type\":\"string\",\"title\":\"id\",\"description\":\"Action ID.\",\"enum\":[\"SendSlackMessage\",\"SendEmail\",\"DeactivatePromotions\"]},\"metadata\":{\"type\":\"object\",\"title\":\"metadata\",\"description\":\"Data inside of the actions.\",\"additionalProperties\":true}},\"type\":\"object\",\"description\":\"Array with actions information.\"},\"description\":\"Actions that the policy will execute.\"},\"resource\":{\"type\":\"string\",\"description\":\"Scope on which this policy must be evaluated.\",\"title\":\"resource\"},\"condition\":{\"type\":\"object\",\"properties\":{\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"This operation will determine if all the conditions need to be valid or at least one of them, if the conditions array is not empty.\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"conditions\":{\"type\":\"array\",\"description\":\"List of conditions that will activate the policy.\",\"items\":{\"description\":\"List of conditions that will activate the policy.\",\"type\":\"object\",\"properties\":{\"conditions\":{\"title\":\"conditions\",\"type\":\"array\",\"description\":\"List of conditions the actions can have. It can be an empty array `[]`.\",\"enum\":[[],[\"stringEquals\"],[\"numericGreaterThan\"]],\"items\":{\"type\":\"string\",\"description\":\"Condition value.\"}},\"operation\":{\"type\":\"string\",\"title\":\"operation\",\"description\":\"The action of the condition.\",\"enum\":[\"None\",\"stringEquals\",\"stringEqualsIgnoreCase\",\"numericEquals\",\"numericLessThan\",\"numericLessThanEquals\",\"numericGreaterThan\",\"numericGreaterThanEquals\",\"bool\",\"not\",\"or\",\"and\",\"dateTimeUtcGreaterThan\",\"dateTimeUtcLessThan\",\"between\"]},\"key\":{\"type\":\"string\",\"title\":\"key\",\"description\":\"The element that will define what the policy will influence.\",\"enum\":[\"skuId\",\"brandId\",\"discountPercentage\"]},\"values\":{\"type\":\"array\",\"title\":\"values\",\"items\":{\"type\":\"string\",\"description\":\"Key value.\"},\"description\":\"Array with values of the key.\"}}}}},\"description\":\"Condition to activate this policy. This object can have a maximum of ten recursive conditions.\",\"title\":\"condition\"}}},\"description\":\"Requirements for the policy to be applied.\"}}},\"description\":\"Array of objects with policies infomation.\"}\n\n// Validate if response matches JSON schema \npm.test(\"[GET]::/api/policy-engine/policies/:id - Schema is valid\", function() {\n pm.response.to.have.jsonSchema(schema,{unknownFormats: [\"int32\", \"int64\", \"float\", \"double\"]});\n});\n" ] } } @@ -552,7 +453,7 @@ } }, { - "id": "c6672d43-1552-4112-b57d-eb16d62d9471", + "id": "e97473bb-2e3b-415f-b000-dbab1d82937a", "name": "Create policy", "request": { "name": "Create policy", @@ -581,24 +482,6 @@ "type": "any", "value": "pa_test_001", "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" } ] }, @@ -620,14 +503,23 @@ }, "key": "Accept", "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/octet-stream" } ], "method": "POST", "body": { "mode": "raw", - "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"ine08\": \"cupidatat fugiat\",\n \"cillum_1\": true\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"irure_4\": -60855921.31526907\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"deserunt2f\": false,\n \"Duis_ae3\": -1767949\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"veniam__3c\": -66175228\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n }\n ]\n}", + "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"dolore_7b6\": -18778176\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"consequatd\": -64948483.97809925,\n \"non_62\": false,\n \"consequat_94\": -30169461\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"cupidatat8d\": true\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"velit__cb\": -27152874\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n }\n ],\n \"status\": \"active\"\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -638,7 +530,7 @@ "_": { "postman_previewlanguage": "text" }, - "id": "5dce5ac1-acb3-4df1-bcfd-b155b790a10a", + "id": "b69a824e-3c47-4a0d-88de-5e60d6d0954c", "name": "OK", "originalRequest": { "url": { @@ -652,46 +544,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "disabled": false, - "description": { - "content": "(Required) Policy ID.", - "type": "text/plain" - }, - "type": "any", - "value": "pa_test_001", - "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -710,17 +565,30 @@ "key": "Accept", "value": "application/json" }, + { + "key": "Content-Type", + "value": "application/json" + }, { "key": "Accept", "value": "application/octet-stream" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "POST", "body": { "mode": "raw", - "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"sed6\": 50061023\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"commodo_9\": -83153761.01837124,\n \"quis_5a\": \"v\"\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"occaecat0\": 85045203\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"esse_d8_\": \"proident eiusmod\",\n \"eu_fa\": \"labore ad mollit\",\n \"elit_b\": 50578452\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n }\n ]\n}", + "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"dolore_7b6\": -18778176\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"consequatd\": -64948483.97809925,\n \"non_62\": false,\n \"consequat_94\": -30169461\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"cupidatat8d\": true\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"velit__cb\": -27152874\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n }\n ],\n \"status\": \"active\"\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -734,7 +602,7 @@ "value": "application/octet-stream" } ], - "body": "", + "body": "[\n {\n \"name\": \"MyAlert\",\n \"description\": \"TestPromotionsAlert\",\n \"status\": \"inactive\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {}\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:example:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"operation\": \"numericGreaterThan\",\n \"key\": \"discountPercentage\",\n \"values\": [\n \"41.00\"\n ]\n }\n ],\n \"operation\": \"and\"\n }\n }\n ]\n }\n]", "cookie": [] } ], @@ -742,7 +610,7 @@ { "listen": "test", "script": { - "id": "665bbdb5-be9d-4226-9693-629c3f2ed9e5", + "id": "71e1140c-086c-4362-9852-80af6a66ee88", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[POST]::/api/policy-engine/policies/:id - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n", @@ -756,7 +624,7 @@ } }, { - "id": "a41195f4-7c78-47ec-967c-9fdc55c7fc75", + "id": "9fa6e723-eb38-448a-b4f4-1daf8d20851b", "name": "Update policy", "request": { "name": "Update policy", @@ -785,24 +653,6 @@ "type": "any", "value": "pa_test_001", "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" } ] }, @@ -824,14 +674,23 @@ }, "key": "Accept", "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/octet-stream" } ], "method": "PUT", "body": { "mode": "raw", - "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"sed6\": 50061023\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"commodo_9\": -83153761.01837124,\n \"quis_5a\": \"v\"\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"occaecat0\": 85045203\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"esse_d8_\": \"proident eiusmod\",\n \"eu_fa\": \"labore ad mollit\",\n \"elit_b\": 50578452\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n }\n ]\n}", + "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"dolore_7b6\": -18778176\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"consequatd\": -64948483.97809925,\n \"non_62\": false,\n \"consequat_94\": -30169461\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"cupidatat8d\": true\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"velit__cb\": -27152874\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n }\n ],\n \"status\": \"active\"\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -842,7 +701,7 @@ "_": { "postman_previewlanguage": "text" }, - "id": "4a272939-eb72-4ac1-9069-02519001e7c1", + "id": "13c06e18-23cb-4eb5-acd9-0884e01d7066", "name": "OK", "originalRequest": { "url": { @@ -856,46 +715,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "disabled": false, - "description": { - "content": "(Required) Policy ID.", - "type": "text/plain" - }, - "type": "any", - "value": "pa_test_001", - "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -914,17 +736,30 @@ "key": "Accept", "value": "application/json" }, + { + "key": "Content-Type", + "value": "application/json" + }, { "key": "Accept", "value": "application/octet-stream" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "PUT", "body": { "mode": "raw", - "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"sed6\": 50061023\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"commodo_9\": -83153761.01837124,\n \"quis_5a\": \"v\"\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"occaecat0\": 85045203\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"esse_d8_\": \"proident eiusmod\",\n \"eu_fa\": \"labore ad mollit\",\n \"elit_b\": 50578452\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n },\n \"operation\": \"None\"\n }\n ]\n}", + "raw": "{\n \"name\": \"id\",\n \"description\": \"TesteMarcosPromotionsAlert\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"dolore_7b6\": -18778176\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"consequatd\": -64948483.97809925,\n \"non_62\": false,\n \"consequat_94\": -30169461\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n },\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"cupidatat8d\": true\n }\n },\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {\n \"velit__cb\": -27152874\n }\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert\",\n \"condition\": {\n \"operation\": \"None\",\n \"conditions\": [\n {\n \"conditions\": [\n \"numericGreaterThan\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n },\n {\n \"conditions\": [\n \"stringEquals\"\n ],\n \"operation\": \"None\",\n \"key\": \"skuId\",\n \"values\": [\n \"40.00\",\n \"40.00\"\n ]\n }\n ]\n }\n }\n ],\n \"status\": \"active\"\n}", "options": { "raw": { + "headerFamily": "json", "language": "json" } } @@ -938,7 +773,7 @@ "value": "application/octet-stream" } ], - "body": "", + "body": "[\n {\n \"name\": \"MyAlert\",\n \"description\": \"TestPromotionsAlert\",\n \"status\": \"inactive\",\n \"statements\": [\n {\n \"effect\": \"Allow\",\n \"actions\": [\n {\n \"id\": \"SendSlackMessage\",\n \"metadata\": {}\n }\n ],\n \"resource\": \"vrn:vtex.promotions-alert:aws-us-east-1:example:master:/_v/promotions_alert\",\n \"condition\": {\n \"conditions\": [\n {\n \"operation\": \"numericGreaterThan\",\n \"key\": \"discountPercentage\",\n \"values\": [\n \"41.00\"\n ]\n }\n ],\n \"operation\": \"and\"\n }\n }\n ]\n }\n]", "cookie": [] } ], @@ -946,7 +781,7 @@ { "listen": "test", "script": { - "id": "cf637b98-4854-4f44-8dc7-8fddfdfd4660", + "id": "73f18e40-ced2-4682-bccf-835c09240931", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[PUT]::/api/policy-engine/policies/:id - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n", @@ -960,7 +795,7 @@ } }, { - "id": "25c56a1a-e53d-41db-86da-b96e479914d5", + "id": "50d74520-a3a0-4fbc-9fcb-d0ef2c8bc56e", "name": "Delete policy by ID", "request": { "name": "Delete policy by ID", @@ -989,24 +824,6 @@ "type": "any", "value": "pa_test_001", "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" } ] }, @@ -1030,14 +847,15 @@ "value": "application/json" } ], - "method": "DELETE" + "method": "DELETE", + "body": {} }, "response": [ { "_": { "postman_previewlanguage": "text" }, - "id": "32bd3c0f-90c2-48bc-acb1-0a6aa70d89d1", + "id": "cc9080c5-156d-4a9b-8949-7293fabb12f6", "name": "200 OK", "originalRequest": { "url": { @@ -1051,46 +869,9 @@ "{{baseUrl}}" ], "query": [], - "variable": [ - { - "disabled": false, - "description": { - "content": "(Required) Policy ID.", - "type": "text/plain" - }, - "type": "any", - "value": "pa_test_001", - "key": "id" - }, - { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, - "type": "any", - "value": "{{accountName}}", - "key": "accountName" - }, - { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, - "type": "any", - "value": "{{environment}}", - "key": "environment" - } - ] + "variable": [] }, "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "X-VTEX-API-AppKey", - "value": "" - }, { "disabled": false, "description": { @@ -1108,6 +889,14 @@ }, "key": "Accept", "value": "application/json" + }, + { + "description": { + "content": "Added as a part of security scheme: apikey", + "type": "text/plain" + }, + "key": "X-VTEX-API-AppKey", + "value": "" } ], "method": "DELETE", @@ -1115,13 +904,7 @@ }, "status": "OK", "code": 200, - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "body": "", + "header": [], "cookie": [] } ], @@ -1129,7 +912,7 @@ { "listen": "test", "script": { - "id": "fd58989d-e4a3-4bdc-90c2-d032e8c7b335", + "id": "ac887f63-0f57-4cc7-9984-aebaa340a2a4", "type": "text/javascript", "exec": [ "// Validate status 2xx \npm.test(\"[DELETE]::/api/policy-engine/policies/:id - Status code is 2xx\", function () {\n pm.response.to.be.success;\n});\n" @@ -1168,35 +951,27 @@ "event": [], "variable": [ { - "description": { - "content": "Name of the VTEX account. Used as part of the URL.", - "type": "text/plain" - }, "type": "any", "value": "apiexamples", "key": "accountName" }, { - "description": { - "content": "Environment to use. Used as part of the URL. (This can only be one of vtexcommercestable)", - "type": "text/plain" - }, "type": "any", "value": "vtexcommercestable", "key": "environment" }, { - "type": "string", + "type": "any", "value": "https://{{accountName}}.{{environment}}.com.br", "key": "baseUrl" } ], "info": { - "_postman_id": "1c6db4dc-aa94-413a-9ff0-6df857b177a1", + "_postman_id": "bc0e3c08-b3b5-4724-81a3-6a2c2b75133a", "name": "Policies System API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "description": { - "content": "This API will create promotion alarms when selling products with undesired prices and promotions. It will create conditions that will check if the prices and the promotions are correct. If not, the system will alarm the store with information about the product sold at unexpected prices.\r\n\r\n ## Index\r\n\r\n- `GET` [Get Policy List](https://developers.vtex.com/docs/api-reference/policies-system-api#get-/api/policy-engine/policies)\r\n- `POST` [Evaluate Policies](https://developers.vtex.com/docs/api-reference/policies-system-api#post-/api/policy-engine/evaluate)\r\n- `GET` [Get Policy by ID](https://developers.vtex.com/docs/api-reference/policies-system-api#get-/api/policy-engine/policies/-id-)\r\n- `POST` [Create Policy](https://developers.vtex.com/docs/api-reference/policies-system-api#post-/api/policy-engine/policies/-id-)\r\n- `PUT` [Update Policy](https://developers.vtex.com/docs/api-reference/policies-system-api#put-/api/policy-engine/policies/-id-)\r\n- `DELETE` [Delete Policy by ID](https://developers.vtex.com/docs/api-reference/policies-system-api#delete-/api/policy-engine/policies/-id-)", + "content": "This API will create promotion alarms when selling products with undesired prices and promotions. It will create conditions that will check if the prices and the promotions are correct. If not, the system will alarm the store with information about the product sold at unexpected prices.", "type": "text/plain" } } diff --git a/VTEX - Policies System API.json b/VTEX - Policies System API.json index 1f2a1316b..a801813b0 100644 --- a/VTEX - Policies System API.json +++ b/VTEX - Policies System API.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Policies System API", - "description": "This API will create promotion alarms when selling products with undesired prices and promotions. It will create conditions that will check if the prices and the promotions are correct. If not, the system will alarm the store with information about the product sold at unexpected prices.\r\n\r\n ## Index\r\n\r\n- `GET` [Get Policy List](https://developers.vtex.com/docs/api-reference/policies-system-api#get-/api/policy-engine/policies)\r\n- `POST` [Evaluate Policies](https://developers.vtex.com/docs/api-reference/policies-system-api#post-/api/policy-engine/evaluate)\r\n- `GET` [Get Policy by ID](https://developers.vtex.com/docs/api-reference/policies-system-api#get-/api/policy-engine/policies/-id-)\r\n- `POST` [Create Policy](https://developers.vtex.com/docs/api-reference/policies-system-api#post-/api/policy-engine/policies/-id-)\r\n- `PUT` [Update Policy](https://developers.vtex.com/docs/api-reference/policies-system-api#put-/api/policy-engine/policies/-id-)\r\n- `DELETE` [Delete Policy by ID](https://developers.vtex.com/docs/api-reference/policies-system-api#delete-/api/policy-engine/policies/-id-)", + "description": "This API will create promotion alarms when selling products with undesired prices and promotions. It will create conditions that will check if the prices and the promotions are correct. If not, the system will alarm the store with information about the product sold at unexpected prices.", "contact": {}, "version": "" },