# How to Call the Get User Dashboard API source: https://developer.mastercard.com/priceless-planet-carbon-tracker/tutorial/test-cases/step4/index.md ### Allow users to access the Carbon Calculator Experience dashboard {#allow-users-to-access-the-carbon-calculator-experience-dashboard} The **Get User Dashboard** service allows the issuer to fetch the short-lived URL of the consumer dashboard. ## Pre-requisites {#pre-requisites} Before executing the test cases, acquaint yourself with the endpoint use case and parameters: * [Get User Dashboard](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/use-cases/get_dashboard/index.md) * [Get Dashboard URL Parameters](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/parameters/index.md#get_dashboard-url/) ## Fetch the Carbon Calculator Experience dashboard URL {#fetch-the-carbon-calculator-experience-dashboard-url} 1. To fetch the Carbon Calculator Experience dashboard, send a GET request. 2. To create a GET request, provide the `userid` and the preferred language (`lang`) as the path parameter. ```py GET https://sandbox.api.mastercard.com/cts/issuers/users/c8b38606-12b2-43c6-a641-be8eb0ab9dec/dashboards?lang=en-US ``` 3. A successful request returns the `HTTP 200 Success` with a short-lived URL to access the dashboard along with an authentication token and its expiry time in milliseconds. ```json { "url": "https://carbon-calculator-experience-mtf.apps.stl.pcfprod00.mastercard.int/#/webview/home?auth_token=eyJ4NXQjUzI1NiI6IktZcVRVVy1MM21GbkkyQ0lfMHVEVXRNNF84Uk9WOW10RlgzNXp4b21zYWsiLCJraWQiOiI4ODc3OS1BUElfRW5hYmxlbWVudF9TeW5hcHNlX1BEUCIsImN0eSI6IkpXUyIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJ1c2VyX2NvbnNlbnQiOiJmYWxzZSIsInN1YiI6Im5vdF9hdmFpbGFibGUiLCJzY3AiOiJjb20ubWFzdGVyY2FyZC5wcmljZWxlc3NwbGFuZXQ6Y2FyYm9uLXRyYWNrZXI6Y2FyYm9uLXRyYWNrZXItYXBpLXByaXZhdGU6M2VkYzRlNjMtZDI2NC00YzY5LWE3OWQtOGVjNjllNDRjNTg2IiwiZ3JwIjpbXSwiaXNzIjoiTUFTVEVSQ0FSRF9TQVMiLCJ0aWQiOiJub3RfYXZhaWxhYmxlIiwiYXVkIjoiUHJpY2VsZXNzUGxhbmV0Q2FyYm9uVHJhY2tlciIsIm5iZiI6MTYzODk3MjU4NywiZ3JhbnRfdHlwZSI6Im9hdXRoMl9hY2Nlc3NfdG9rZW4iLCJleHAiOjE2Mzg5NzM0ODcsIm9uZV90aW1lIjoiZmFsc2UiLCJpYXQiOjE2Mzg5NzI1ODcsImp0aSI6ImVmNmU4N2ZkNWVjMTI0YWY1OGI0YjgzYTc4NjA1NTY2IiwiY2lkIjoiQjZBbzVFNzFXbjM3Wm15OERiTVVkWHE4WFE0VHFwQTVmMHJzOGxWMDcxODA5ODQ0In0.aAq6YajYpAiJVSdkqZPaxcCHPkt4GuWmA_qHMk9lXmqpxHRbZWWG09k2IszAJpelswREwqhG-vi7EfKUmidMulpQDJywQdV2zRRyYjIgK0ZABS1KW2m8f9j_I0buXuHB-cv6yT3Ps0VGIbl9qYTOVba-Drf3ahJAwHoQH1JdfdV75Ai9arMoKfynS6Kf_hBBECKifYjVL4ot7RQqgTB52VN_rbtUjeugre7C77SZDn4jm0qXd1FXN1Ht90hI9WqrMsNPy3ixqsRsaElmPA-_PB8ohGXBAGYwk1JjIUohCqhej3GSjiJKT60k6u6vaUGaeyquNujVAZLC-9bjmz1Pdg&lang=en-US", "expiryInMillis": "900000" } ``` ## Failed scenarios {#failed-scenarios} This section discusses a failed scenario and the error message expected. ### Fetch the dashboard URL for a non-existent user {#fetch-the-dashboard-url-for-a-non-existent-user} 1. To fetch the Carbon Calculator Experience dashboard, send a GET request. 2. Provide the `userid` of a user who is deleted from the platform and the preferred language (`lang`) as the path parameter. ```py GET https://sandbox.api.mastercard.com/cts/issuers/users/4ba581a55-bcea-4c3e-8e0f-9b4726e5e6d3/dashboards?lang=en-US ``` 3. This request fails with the error code `HTTP 400 Bad Request` as the response. ```json { "Errors": { "Error": [ { "Source": "CARBON CALCULATOR EXPERIENCE", "ReasonCode": "USER_NOT_FOUND", "Description": "We cannot find user details for provided userId. Kindly register user through enrolment process.", "Recoverable": false, "Details": "Make sure user is enrolled through /issuers/users API endpoint." } ] } } ``` ### Fetch the dashboard URL with an invalid user ID {#fetch-the-dashboard-url-with-an-invalid-user-id} 1. To fetch the Carbon Calculator Experience dashboard, send a GET request. 2. Provide an invalid user ID and the preferred language (`lang`) as the path parameter. ```py GET https://sandbox.api.mastercard.com/cts/issuers/users/4ba581a55-bcea-4c3e-8e0f-9b4726e5e6d3895N954/dashboards?lang=en-US ``` 3. This request fails with the error code `HTTP 400 Bad Request` as the response. ```json { "Errors": { "Error": [ { "Source": "CARBON CALCULATOR EXPERIENCE", "ReasonCode": "INVALID_REQUEST_PARAMETER", "Description": "One of the request parameters is invalid, try again with correct request.", "Recoverable": false, "Details": "UserId should be of size 36" } ] } } ``` Note: Currently, we do not support test cards in the sandbox.