{ "info": { "_postman_id": "ab836860-c525-457a-8d39-032935ef4630", "name": "PRISM API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Order and Tenant Creation", "item": [ { "name": "Get User Authentication Token", "event": [ { "listen": "test", "script": { "id": "82bb3d63-bb2a-4681-a361-088eb8892203", "exec": [ "var jsonData = JSON.parse(responseBody);", "postman.setEnvironmentVariable(\"access_token\", jsonData.access_token);", "pm.test(\"respone status is 200 OK\", function () {", " pm.response.to.have.status(200);", " pm.expect(jsonData.expires_in).to.equal(3600)", "});", "", "pm.test(\"Response should contain an Access Token\", function () {", " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", " pm.expect(jsonData.expires_in).to.equal(3600)", " pm.expect(jsonData.access_token).not.to.be.empty", " pm.expect(jsonData.token_type).to.equal('Bearer')", "", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "client_id", "value": "{{client_id}}", "type": "text" }, { "key": "client_secret", "value": "{{client_secret}}", "type": "text" }, { "key": "scope", "value": "rhipeapi", "type": "text" } ] }, "url": { "raw": "https://{{release_identity_server}}/core/connect/token", "protocol": "https", "host": [ "{{release_identity_server}}" ], "path": [ "core", "connect", "token" ] } }, "response": [ { "name": "MCA acceptance", "originalRequest": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "client_id", "value": "32bfcc5d-b8cd-4776-b832-e5400ff316f6", "type": "text" }, { "key": "client_secret", "value": "61708fffdc594c6383a6181679c77f30", "type": "text" }, { "key": "scope", "value": "rhipeapi", "type": "text" } ] }, "url": { "raw": "https://{{release_environment}}/core/connect/token", "protocol": "https", "host": [ "{{release_environment}}" ], "path": [ "core", "connect", "token" ] } }, "status": "OK", "code": 200, "_postman_previewlanguage": "json", "header": [ { "key": "Cache-Control", "value": "no-store, no-cache, max-age=0, private", "name": "Cache-Control", "description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds" }, { "key": "Content-Encoding", "value": "gzip", "name": "Content-Encoding", "description": "The type of encoding used on the data." }, { "key": "Content-Length", "value": "1640", "name": "Content-Length", "description": "The length of the response body in octets (8-bit bytes)" }, { "key": "Content-Type", "value": "application/json; charset=utf-8", "name": "Content-Type", "description": "The mime type of this content" }, { "key": "Date", "value": "Thu, 27 Sep 2018 03:43:41 GMT", "name": "Date", "description": "The date and time that the message was sent" }, { "key": "Pragma", "value": "no-cache", "name": "Pragma", "description": "Implementation-specific headers that may have various effects anywhere along the request-response chain." }, { "key": "Server", "value": "Microsoft-IIS/10.0", "name": "Server", "description": "A name for the server" }, { "key": "Vary", "value": "Accept-Encoding", "name": "Vary", "description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server." }, { "key": "X-Powered-By", "value": "ASP.NET", "name": "X-Powered-By", "description": "Specifies the technology (ASP.NET, PHP, JBoss, e.g.) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)" } ], "cookie": [ { "expires": "Invalid Date", "httpOnly": true, "domain": "mca-rhipe-identity.azurewebsites.net", "path": "/", "secure": false, "value": "24c45f78ef697cc22127d7ebe6a38548151c30df65eaf6699dbe12b54adc600d", "key": "ARRAffinity" } ], "body": "{\"access_token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InlUd084T0VfTE9IN1gtVlZVVklrS19TUVV2cyIsImtpZCI6InlUd084T0VfTE9IN1gtVlZVVklrS19TUVV2cyJ9.eyJpc3MiOiJodHRwczovL21jYS1yaGlwZS1pZGVudGl0eS5henVyZXdlYnNpdGVzLm5ldC9jb3JlIiwiYXVkIjoiaHR0cHM6Ly9tY2EtcmhpcGUtaWRlbnRpdHkuYXp1cmV3ZWJzaXRlcy5uZXQvY29yZS9yZXNvdXJjZXMiLCJleHAiOjE1MzgwMjM0MjEsIm5iZiI6MTUzODAxOTgyMSwiY2xpZW50X2lkIjoiMzJiZmNjNWQtYjhjZC00Nzc2LWI4MzItZTU0MDBmZjMxNmY2Iiwic3ViIjoiMzJiZmNjNWQtYjhjZC00Nzc2LWI4MzItZTU0MDBmZjMxNmY2IiwiZW1haWwiOiJuYXZlZW4uc2lkZGFwYUByaGlwZS5jb20iLCJyb2xlIjoiR2xvYmFsLkN1c3RvbWVyQWRtaW4iLCJzY29wZSI6InJoaXBlYXBpIiwiY3VzdG9tZXJfaWQiOiJGREUwNDBCQi1BOTZCLTRCM0UtQUY4Qi05OUZDNDE0NkUwMzUiLCJ0ZW5hbnRfaWQiOiJiMjI0YmM2NS1kMTJlLTRlMzctYjMyMC02Y2NhYWExNGZiZTUiLCJjbGllbnRfbmFtZSI6IkFQSVRFU1QiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJBUElURVNUIn0.dF-Rxaw0_Ogt7WoDhcb070FR2ayONNHQgOW30xFAspysqC3aZvjWHHZurte-RbM8HKDKVQTJVkNUNuLVbfEbtX305V6qaEujKoUu9V_X7PvKUnb9AbzJe5-YZbxiI45Igc9jZLoW6y2Hw2d98VkiGByN4hz-qjKTYQ2c316ihilPujbf-sn7hdlc4wKJYHtVXW7PcfLGDvd7Tzi9FiHDRtB7ofDzoaZ7ih0xAHk_ADpC5x5tZkGoagKEiENHNGyVf3YHCv1SFlQzSZzi1QgyPeE3jGSIsw_nr8PE_-7lY_qbrL8dDUmyZroQOuauNvRfsJ_2F6AaT-KZhFdGPI7TGJZZkxWeBLM7XoyOHT6S-geWReyGMsOkwcyraFDBVyEuPslHqKASHhqCXeU6rjLk6xvdY72O7Oe9Al59-wrYSLsmVoFhrtTQNTm19tFgiF5507g0DlNfCCJLKqAjRRy6GucoUm8juWMKNr9atyzPRILzdqAsVvCM58EeX58ZlWaWlt9aPdeBSUTQ6q95q2jGKLvqEkQa_Rej7FPzIys7ey2GW9hDKurFZp_0YRxGkayGIAd4SCVVTCeCD1cERmZB9PIh9_FuTdbk5K2OmyuIHsO7rW8KFhrMA1CygxApPAEou_gUE0Do_TXxUFBz0Xa0xS32yiqg8rEsEeQ8x7-nRmI\",\"expires_in\":3600,\"token_type\":\"Bearer\"}" } ] }, { "name": "Create PRISM Customer", "event": [ { "listen": "prerequest", "script": { "id": "fc4166b9-c13e-4a7a-afc9-2baddbf7b834", "exec": [ "function getRandomNumber(minValue, maxValue) {\r", " return Math.floor(Math.random() * (maxValue - minValue +1)) ;\r", "}\r", "var myRandomNumber = getRandomNumber(0, 1000);\r", "postman.setEnvironmentVariable(\"myRandomNumber\", myRandomNumber);\r", "console.log(myRandomNumber);" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "40b4e171-3fb6-426d-adf4-3803e884dfdd", "exec": [ "var customerID = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"customerID\", customerID);\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Body is correct\", function () {\r", " pm.expect('customerID').to.be.a('string');\r", "});\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n\t\"CustomerName\": \"APITEST_{{myRandomNumber}}\",\n\t\"WebUrl\": \"Test@test.com\",\n\t\"Email\": \"naveen.siddapa@rhipe.com\",\n\t\"RegistrationNumber\": \"456525652365\",\n\t\"Address\": {\n\t\t\"Street1\": \"Street1\",\n\t\t\"Street2\": \"Street2\",\n\t\t\"Street3\": \"Street3\",\n\t\t\"State\": \"VIC\",\n\t\t\"City\": \"Melbourne\",\n\t\t\"Postcode\": \"3000\",\n\t\t\"Country\": \"Australia\",\n\t\t\"Iso2Code\": \"AU\"\n\t},\n\t\"BillingAddress\": {\n\t\t\"Street1\": \"Street1\",\n\t\t\"Street2\": \"Street2\",\n\t\t\"Street3\": \"Street3\",\n\t\t\"State\": \"VIC\",\n\t\t\"City\": \"Melbourne\",\n\t\t\"Postcode\": \"3000\",\n\t\t\"Country\": \"Australia\",\n\t\t\"Iso2Code\": \"AU\"\n\t}\n}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/customers", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "customers" ] } }, "response": [] }, { "name": "Create MS Tenant by Skipping MCA details", "event": [ { "listen": "prerequest", "script": { "id": "4b3088c1-34bf-4aff-8e74-caef6aa1b9cf", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "764927a4-a13f-42b1-aa04-585d1f9c7a08", "exec": [ "var TenantCreationResponse = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"TenantId\", TenantCreationResponse.TenantId);\r", "postman.setEnvironmentVariable(\"LongRunningTaskRefUrl\", TenantCreationResponse.LongRunningTaskRef.Url);\r", "\r", "\r", "\r", "pm.test(\"Successful POST request\", function () {\r", " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", "});\r", "pm.test(\"TenantID is retuned\", function () {\r", " pm.expect('TenantId').not.to.be.empty;\r", " pm.expect('TenantId').to.be.a('string');\r", "});\r", "\r", "pm.test(\"Long Running Task URL is returned\", function () {\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').not.to.be.empty;\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').to.be.a('string');\r", "});\r", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "\r\n{\r\n\t\"ContractAgreementId\": \"{{ContractAgreementId}}\",\r\n\t\"EndCustomerId\": \"{{customerID}}\",\r\n\t\"DefaultDomainPrefix\": \"APITest{{myRandomNumber}}\",\r\n\t\"ContactFirstName\": \"admin\",\r\n\t\"ContactLastName\": \"nzpartnercc\",\r\n\t\"ContactPhoneNumber\": \"385669856\",\r\n\t\"ContactEmailAddress\": \"admin@nzpartnercc.com\",\r\n\t\"MicrosoftMarketCategory\": \"Academic\",\r\n\t\"MicrosoftCloudAgreement\": {\r\n\t\t\"FirstName\": \"FirstName\",\r\n\t\t\"LastName\": \"LastName\",\r\n\t\t\"EmailAddress\": \"EmailAddress@testmail.com\",\r\n\t\t\"PhoneNumber\": \"052369980\",\r\n\t \"dateSigned\": \"2020-05-11T04:20:06.063Z\"\r\n\t}\r\n}\r\n" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/tenants", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "tenants" ] } }, "response": [] }, { "name": "Verify the LongRunning Status for Tenant Creation completion", "event": [ { "listen": "prerequest", "script": { "id": "055e1818-50d2-4d11-92a0-ad81e44df9d5", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "67c51ac8-7179-4f82-8792-07ebce00e0d2", "exec": [ "var LongrunningTaskResponse = JSON.parse(responseBody);\r", "\r", "\r", "\r", "if (LongrunningTaskResponse.Status===\"Success\"){\r", " \r", "\r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Successfully Completed\", function () {\r", " pm.expect(jsonData.Status).to.equal('Success')\r", " pm.expect(jsonData.Description).to.eql('Provisioning new Microsoft CSP tenant');\r", " pm.expect(jsonData.Outcome).to.eql('Tenant creation complete');\r", "});\r", " \r", "}else if (LongrunningTaskResponse.Status===\"InProgress\"){\r", " setTimeout(function(){}, 3000);\r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Description\", function () {\r", " pm.expect(jsonData.Status).to.equal('InProgress')\r", " pm.expect(jsonData.Description).to.eql('Provisioning new Microsoft CSP tenant');\r", " \r", "});\r", " postman.setNextRequest(\"Verify the LongRunning Status for Tenant Creation completion\"); \r", " /* you can also try postman.setNextRequest(null); */ \r", "}else{\r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Description\", function () {\r", " pm.expect(jsonData.Message).to.equal('Task not found or insufficient permissions')});\r", " postman.setNextRequest(\"Verify the LongRunning Status for Tenant Creation completion\"); \r", "}\r", "\r", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "https://{{release_prism_server}}{{LongRunningTaskRefUrl}}", "protocol": "https", "host": [ "{{release_prism_server}}{{LongRunningTaskRefUrl}}" ] } }, "response": [] }, { "name": "Check for MCA agreement", "event": [ { "listen": "test", "script": { "id": "593caafc-7378-4ddd-8365-ce3d05a0138a", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/tenants/{{TenantId}}/agreements", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "tenants", "{{TenantId}}", "agreements" ] } }, "response": [] }, { "name": "Get Products", "event": [ { "listen": "test", "script": { "id": "a441615d-2231-4b02-a530-e46e7c40d57f", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/tenants/{{TenantId}}/agreements", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "tenants", "{{TenantId}}", "agreements" ] } }, "response": [] }, { "name": "Add Subscription-M365", "event": [ { "listen": "test", "script": { "id": "30fcebed-28ce-40c2-80ad-75e5eb18e328", "exec": [ "pm.test(\"Body matches string\", function () {", " pm.expect(pm.response.text()).to.include(\"A signed Microsoft Cloud Agreement is required\");", "});", "pm.test(\"Verify Bad request response\", function () {", " pm.expect(pm.response.code).to.be.oneOf([400]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"TenantId\":\"{{TenantId}}\",\"Products\":[{\"ProductId\":\"fe91fe65-6bef-4c88-bd8c-f947c3d22321\",\"Qty\":1}]}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/orders", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "orders" ] } }, "response": [] }, { "name": "Sign MCA Agreement", "event": [ { "listen": "test", "script": { "id": "71957fc4-ebda-4bd9-8305-5005b0922fc2", "exec": [ "pm.test(\"Successful POST request\", function () {", " pm.expect(pm.response.code).to.be.oneOf([201,202]);", "});", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "type", "value": "MicrosoftCloudAgreement", "type": "text" }, { "key": "dateAgreed", "value": "2018-09-27T06:28:02.100Z", "type": "text" }, { "key": "primaryContactEmail", "value": "email@validation.com", "type": "text" }, { "key": "primaryContactFirstName", "value": "FirstName", "type": "text" }, { "key": "primaryContactLastName", "value": "lastName", "type": "text" }, { "key": "primaryContactPhoneNumber", "value": "3452345", "type": "text" } ] }, "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/tenants/{{TenantId}}/agreements", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "tenants", "{{TenantId}}", "agreements" ] } }, "response": [] }, { "name": "Transition", "event": [ { "listen": "test", "script": { "id": "3ef3a9c7-aac4-43a9-926a-d4494161e6ee", "exec": [ "var TenantCreationResponse = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"TenantId\", TenantCreationResponse.TenantId);\r", "postman.setEnvironmentVariable(\"LongRunningTaskRefUrl\", TenantCreationResponse.LongRunningTaskRef.Url);\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(202);\r", "});\r", "\r", "pm.test(\"TenantID is retuned\", function () {\r", " pm.expect('TenantId').not.to.be.empty;\r", " pm.expect('TenantId').to.be.a('string');\r", "});\r", "\r", "pm.test(\"Long Running Task URL is returned\", function () {\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').not.to.be.empty;\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').to.be.a('string');\r", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"TenantId\": \"{{TenantId}}\",\n \"Products\": [\n {\n \"ProductId\": \"fe91fe65-6bef-4c88-bd8c-f947c3d22321\",\n \"Qty\": 1\n }\n ]\n}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/orders", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "orders" ] } }, "response": [] }, { "name": "Add Add-on", "event": [ { "listen": "test", "script": { "id": "86249f30-cc50-41e8-a961-97aa9ef3cbcf", "exec": [ "var TenantCreationResponse = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"TenantId\", TenantCreationResponse.TenantId);\r", "postman.setEnvironmentVariable(\"LongRunningTaskRefUrl\", TenantCreationResponse.LongRunningTaskRef.Url);\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(202);\r", "});\r", "\r", "pm.test(\"TenantID is retuned\", function () {\r", " pm.expect('TenantId').not.to.be.empty;\r", " pm.expect('TenantId').to.be.a('string');\r", "});\r", "\r", "pm.test(\"Long Running Task URL is returned\", function () {\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').not.to.be.empty;\r", " pm.expect('TenantCreationResponse.LongRunningTaskRef.Url').to.be.a('string');\r", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"TenantId\": \"{{TenantId}}\",\n \"Products\": [\n {\n \"ProductId\": \"fe91fe65-6bef-4c88-bd8c-f947c3d22321\",\n \"Qty\": 1\n }\n ]\n}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/microsoftcsp/orders", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "microsoftcsp", "orders" ] } }, "response": [] }, { "name": "Verify Long Running status for OrderDetails", "event": [ { "listen": "prerequest", "script": { "id": "7f7b322d-11bb-48f9-b775-9230e5f8955d", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "c67fea28-6373-438a-abc9-be2d0f69088a", "exec": [ "var LongrunningTaskResponse = JSON.parse(responseBody);\r", "\r", "\r", "if (LongrunningTaskResponse.Status===\"Success\"){\r", " \r", " \r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Description\", function () {\r", " pm.expect(jsonData.Status).to.equal('Success')\r", " pm.expect(jsonData.Description).to.eql('Order submitted for processing');\r", " pm.expect(jsonData.Outcome).to.eql('Order complete');\r", "});\r", " \r", "} else if (LongrunningTaskResponse.Status===\"InProgress\"){\r", " setTimeout(function(){}, 3000);\r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Description\", function () {\r", " pm.expect(jsonData.Status).to.equal('InProgress')\r", " pm.expect(jsonData.Description).to.eql('Order submitted for processing');\r", " pm.expect(jsonData.Outcome).to.eql('Provisioning order with Microsoft.');\r", "});\r", " \r", " postman.setNextRequest(\"Verify Long Running status for OrderDetails\"); \r", " /* you can also try postman.setNextRequest(null); */ \r", "}else{\r", " var jsonData = pm.response.json();\r", " pm.test(\"Long Running Task Description\", function () {\r", " pm.expect(jsonData.Message).to.equal('Task not found or insufficient permissions')});\r", " postman.setNextRequest(\"Verify Long Running status for OrderDetails\"); \r", "}\r", "\r", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "https://{{release_prism_server}}{{LongRunningTaskRefUrl}}", "protocol": "https", "host": [ "{{release_prism_server}}{{LongRunningTaskRefUrl}}" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "MS SPLA", "item": [ { "name": "Get User Authentication Token", "event": [ { "listen": "test", "script": { "id": "5195b042-7fde-40de-aec0-cfcd2d7b9ff6", "exec": [ "var jsonData = JSON.parse(responseBody);", "postman.setEnvironmentVariable(\"access_token\", jsonData.access_token);", "pm.test(\"respone status is 200 OK\", function () {", " pm.response.to.have.status(200);", " pm.expect(jsonData.expires_in).to.equal(3600)", "});", "", "pm.test(\"Response should contain an Access Token\", function () {", " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", " pm.expect(jsonData.expires_in).to.equal(3600)", " pm.expect(jsonData.access_token).not.to.be.empty", " pm.expect(jsonData.token_type).to.equal('Bearer')", "", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "client_id", "value": "{{client_id}}", "type": "text" }, { "key": "client_secret", "value": "{{client_secret}}", "type": "text" }, { "key": "scope", "value": "rhipeapi", "type": "text" } ] }, "url": { "raw": "https://{{release_identity_server}}/core/connect/token", "protocol": "https", "host": [ "{{release_identity_server}}" ], "path": [ "core", "connect", "token" ] } }, "response": [ { "name": "MCA acceptance", "originalRequest": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "client_id", "value": "32bfcc5d-b8cd-4776-b832-e5400ff316f6", "type": "text" }, { "key": "client_secret", "value": "61708fffdc594c6383a6181679c77f30", "type": "text" }, { "key": "scope", "value": "rhipeapi", "type": "text" } ] }, "url": { "raw": "https://{{release_environment}}/core/connect/token", "protocol": "https", "host": [ "{{release_environment}}" ], "path": [ "core", "connect", "token" ] } }, "status": "OK", "code": 200, "_postman_previewlanguage": "json", "header": [ { "key": "Cache-Control", "value": "no-store, no-cache, max-age=0, private", "name": "Cache-Control", "description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds" }, { "key": "Content-Encoding", "value": "gzip", "name": "Content-Encoding", "description": "The type of encoding used on the data." }, { "key": "Content-Length", "value": "1640", "name": "Content-Length", "description": "The length of the response body in octets (8-bit bytes)" }, { "key": "Content-Type", "value": "application/json; charset=utf-8", "name": "Content-Type", "description": "The mime type of this content" }, { "key": "Date", "value": "Thu, 27 Sep 2018 03:43:41 GMT", "name": "Date", "description": "The date and time that the message was sent" }, { "key": "Pragma", "value": "no-cache", "name": "Pragma", "description": "Implementation-specific headers that may have various effects anywhere along the request-response chain." }, { "key": "Server", "value": "Microsoft-IIS/10.0", "name": "Server", "description": "A name for the server" }, { "key": "Vary", "value": "Accept-Encoding", "name": "Vary", "description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server." }, { "key": "X-Powered-By", "value": "ASP.NET", "name": "X-Powered-By", "description": "Specifies the technology (ASP.NET, PHP, JBoss, e.g.) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)" } ], "cookie": [ { "expires": "Invalid Date", "httpOnly": true, "domain": "mca-rhipe-identity.azurewebsites.net", "path": "/", "secure": false, "value": "24c45f78ef697cc22127d7ebe6a38548151c30df65eaf6699dbe12b54adc600d", "key": "ARRAffinity" } ], "body": "{\"access_token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InlUd084T0VfTE9IN1gtVlZVVklrS19TUVV2cyIsImtpZCI6InlUd084T0VfTE9IN1gtVlZVVklrS19TUVV2cyJ9.eyJpc3MiOiJodHRwczovL21jYS1yaGlwZS1pZGVudGl0eS5henVyZXdlYnNpdGVzLm5ldC9jb3JlIiwiYXVkIjoiaHR0cHM6Ly9tY2EtcmhpcGUtaWRlbnRpdHkuYXp1cmV3ZWJzaXRlcy5uZXQvY29yZS9yZXNvdXJjZXMiLCJleHAiOjE1MzgwMjM0MjEsIm5iZiI6MTUzODAxOTgyMSwiY2xpZW50X2lkIjoiMzJiZmNjNWQtYjhjZC00Nzc2LWI4MzItZTU0MDBmZjMxNmY2Iiwic3ViIjoiMzJiZmNjNWQtYjhjZC00Nzc2LWI4MzItZTU0MDBmZjMxNmY2IiwiZW1haWwiOiJuYXZlZW4uc2lkZGFwYUByaGlwZS5jb20iLCJyb2xlIjoiR2xvYmFsLkN1c3RvbWVyQWRtaW4iLCJzY29wZSI6InJoaXBlYXBpIiwiY3VzdG9tZXJfaWQiOiJGREUwNDBCQi1BOTZCLTRCM0UtQUY4Qi05OUZDNDE0NkUwMzUiLCJ0ZW5hbnRfaWQiOiJiMjI0YmM2NS1kMTJlLTRlMzctYjMyMC02Y2NhYWExNGZiZTUiLCJjbGllbnRfbmFtZSI6IkFQSVRFU1QiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJBUElURVNUIn0.dF-Rxaw0_Ogt7WoDhcb070FR2ayONNHQgOW30xFAspysqC3aZvjWHHZurte-RbM8HKDKVQTJVkNUNuLVbfEbtX305V6qaEujKoUu9V_X7PvKUnb9AbzJe5-YZbxiI45Igc9jZLoW6y2Hw2d98VkiGByN4hz-qjKTYQ2c316ihilPujbf-sn7hdlc4wKJYHtVXW7PcfLGDvd7Tzi9FiHDRtB7ofDzoaZ7ih0xAHk_ADpC5x5tZkGoagKEiENHNGyVf3YHCv1SFlQzSZzi1QgyPeE3jGSIsw_nr8PE_-7lY_qbrL8dDUmyZroQOuauNvRfsJ_2F6AaT-KZhFdGPI7TGJZZkxWeBLM7XoyOHT6S-geWReyGMsOkwcyraFDBVyEuPslHqKASHhqCXeU6rjLk6xvdY72O7Oe9Al59-wrYSLsmVoFhrtTQNTm19tFgiF5507g0DlNfCCJLKqAjRRy6GucoUm8juWMKNr9atyzPRILzdqAsVvCM58EeX58ZlWaWlt9aPdeBSUTQ6q95q2jGKLvqEkQa_Rej7FPzIys7ey2GW9hDKurFZp_0YRxGkayGIAd4SCVVTCeCD1cERmZB9PIh9_FuTdbk5K2OmyuIHsO7rW8KFhrMA1CygxApPAEou_gUE0Do_TXxUFBz0Xa0xS32yiqg8rEsEeQ8x7-nRmI\",\"expires_in\":3600,\"token_type\":\"Bearer\"}" } ] }, { "name": "Create PRISM Customer", "event": [ { "listen": "prerequest", "script": { "id": "3d44bb2a-e86e-47e8-a9e7-aeedaec0932d", "exec": [ "function getRandomNumber(minValue, maxValue) {\r", " return Math.floor(Math.random() * (maxValue - minValue +1)) ;\r", "}\r", "var myRandomNumber = getRandomNumber(0, 1000);\r", "postman.setEnvironmentVariable(\"myRandomNumber\", myRandomNumber);\r", "console.log(myRandomNumber);" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "8fa6483f-023d-4454-8144-ea50f3a11d2e", "exec": [ "var customerID = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"customerID\", customerID);\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Body is correct\", function () {\r", " pm.expect('customerID').to.be.a('string');\r", "});\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n\t\"CustomerName\": \"APITEST_{{myRandomNumber}}\",\n\t\"WebUrl\": \"Test@test.com\",\n\t\"Email\": \"naveen.siddapa@rhipe.com\",\n\t\"RegistrationNumber\": \"456525652365\",\n\t\"Address\": {\n\t\t\"Street1\": \"Street1\",\n\t\t\"Street2\": \"Street2\",\n\t\t\"Street3\": \"Street3\",\n\t\t\"State\": \"VIC\",\n\t\t\"City\": \"Melbourne\",\n\t\t\"Postcode\": \"3000\",\n\t\t\"Country\": \"Australia\",\n\t\t\"Iso2Code\": \"AU\"\n\t},\n\t\"BillingAddress\": {\n\t\t\"Street1\": \"Street1\",\n\t\t\"Street2\": \"Street2\",\n\t\t\"Street3\": \"Street3\",\n\t\t\"State\": \"VIC\",\n\t\t\"City\": \"Melbourne\",\n\t\t\"Postcode\": \"3000\",\n\t\t\"Country\": \"Australia\",\n\t\t\"Iso2Code\": \"AU\"\n\t}\n}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/customers", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "customers" ] } }, "response": [] }, { "name": "Add Customer to MS SPLA", "event": [ { "listen": "prerequest", "script": { "id": "dd9c0eb2-ff2c-4722-9394-5b3f33a893ec", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "dc825094-6f8e-43c9-a0eb-fadded048497", "exec": [ "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Status code is not 400\", function () {\r", " pm.response.to.not.include.status(400);\r", "});\r", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\r\n \"contractAgreementId\": \"{{ContractAgreementId}}\",\r\n \"customerId\": \"{{customerID}}\"\r\n}" }, "url": { "raw": "https://{{release_prism_server}}/api/v2/usage/{{programID}}/customers", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v2", "usage", "{{programID}}", "customers" ] } }, "response": [] }, { "name": "Get SPLA Usages", "event": [ { "listen": "test", "script": { "id": "abafedee-ed4f-4367-bbb7-4491f615c4b5", "exec": [ "var response = JSON.parse(responseBody);\r", "postman.setEnvironmentVariable(\"usage\", response[0].UsageSummaries[0].Status);\r", "\r", "\r", "if (response[0].UsageSummaries[0].Status===\"Submitted\"){\r", " \r", " pm.sendRequest({\r", " url: 'https://api.staging.prismportal.online/api/v1/d3c139d5-b64f-4e7d-aa47-1cd718399f53/usage/spla/b4a76f20-eabd-e711-8175-e0071b69c9d1/2019/2/reset',\r", " method: 'POST',\r", "}, function (err, res) {\r", " console.log(res);\r", " pm.expect(res).to.have.property('code', 200);\r", " pm.expect(res).to.have.property('status', 'OK');\r", "});\r", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "https://{{release_prism_server}}/api/v1/{{CustomerID}}/usage/spla", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v1", "{{CustomerID}}", "usage", "spla" ] } }, "response": [] }, { "name": "SPLA Submit Usage", "event": [ { "listen": "prerequest", "script": { "id": "21113f8d-de79-4a92-a21a-c5687c6571b3", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "a0935b19-a11e-4f29-a499-2c529a5b79e0", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "https://{{release_prism_server}}/api/v1/d3c139d5-b64f-4e7d-aa47-1cd718399f53/usage/spla/b4a76f20-eabd-e711-8175-e0071b69c9d1/2019/2", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v1", "d3c139d5-b64f-4e7d-aa47-1cd718399f53", "usage", "spla", "b4a76f20-eabd-e711-8175-e0071b69c9d1", "2019", "2" ] } }, "response": [] }, { "name": "Reset Usage Copy", "event": [ { "listen": "prerequest", "script": { "id": "cfeb8b69-6e0e-475b-8af2-0202477087a8", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "27b9a365-7fee-48b2-80ab-8bbcb151b2e8", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "https://{{release_prism_server}}/api/v1/d3c139d5-b64f-4e7d-aa47-1cd718399f53/usage/spla/b4a76f20-eabd-e711-8175-e0071b69c9d1/2019/2", "protocol": "https", "host": [ "{{release_prism_server}}" ], "path": [ "api", "v1", "d3c139d5-b64f-4e7d-aa47-1cd718399f53", "usage", "spla", "b4a76f20-eabd-e711-8175-e0071b69c9d1", "2019", "2" ] } }, "response": [] } ], "protocolProfileBehavior": {} } ], "event": [ { "listen": "prerequest", "script": { "id": "9f243ecf-b85c-4779-9bca-552fdd74127b", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "7b5fe788-a2c8-4b59-be2c-eb26c9735270", "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "id": "8693bde2-2bfb-4b35-8f4b-22621128785d", "key": "release_identity_server", "value": "mca-rhipe-identity.azurewebsites.net", "type": "string" }, { "id": "5b69d5d0-74b4-4e75-bf4e-12605277598f", "key": "release_prism_server", "value": "mca-rhipe-api.azurewebsites.net", "type": "string" } ], "protocolProfileBehavior": {} }