|
| 1 | +--- |
| 2 | +title: Delete a lab in Azure Education Hub through REST APIs |
| 3 | +description: Learn how to delete a lab in Azure Education Hub using REST APIs |
| 4 | +author: vinnieangel |
| 5 | +ms.author: vangellotti |
| 6 | +ms.service: azure-education |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 1/24/2022 |
| 9 | +ms.custom: template-how-to |
| 10 | +--- |
| 11 | + |
| 12 | +# Delete a lab in Education Hub through REST APIs |
| 13 | + |
| 14 | +This article will walk you through how to delete a lab with REST APIs that has been created in Education Hub. Note, all students must be deleted from the lab in order for the lab to be able to be deleted. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- Know billing account ID, Billing profile ID, and Invoice Section ID |
| 19 | +- Have an Edu approved Azure account |
| 20 | +- Have a lab already created in Education Hub |
| 21 | + |
| 22 | +## Delete students from a lab |
| 23 | + |
| 24 | +As mentioned previously, before you delete a lab, you must delete every student in the lab first. |
| 25 | + |
| 26 | +To find all of the students that are in a lab, we can call the below API. Replace the text surrounded in the <>. |
| 27 | + |
| 28 | +```json |
| 29 | +GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<BillingAccountID>/billingProfiles/<BillingProfileID>/invoiceSections/<InvoiceSectionID>/providers/Microsoft.Education/labs/default/students?includeDeleted=false&api-version=2021-12-01-preview |
| 30 | +``` |
| 31 | + |
| 32 | +This will return the information about every student in the specified lab. Be sure to note down the ID of every student in the lab because that is what we will be using to delete the students. |
| 33 | + |
| 34 | +```json |
| 35 | +{ |
| 36 | + "value": [ |
| 37 | + { |
| 38 | + "id": "string", |
| 39 | + "name": "string", |
| 40 | + "type": "string", |
| 41 | + "systemData": { |
| 42 | + "createdBy": "string", |
| 43 | + "createdByType": "User", |
| 44 | + "createdAt": "2021-12-22T17:17:07.542Z", |
| 45 | + "lastModifiedBy": "string", |
| 46 | + "lastModifiedByType": "User", |
| 47 | + "lastModifiedAt": "2021-12-22T17:17:07.542Z" |
| 48 | + }, |
| 49 | + "properties": { |
| 50 | + "firstName": "string", |
| 51 | + "lastName": "string", |
| 52 | + "email": "string", |
| 53 | + "role": "Student", |
| 54 | + "budget": { |
| 55 | + "currency": "string", |
| 56 | + "value": 0 |
| 57 | + }, |
| 58 | + "subscriptionId": "string", |
| 59 | + "expirationDate": "2021-12-22T17:17:07.542Z", |
| 60 | + "status": "Active", |
| 61 | + "effectiveDate": "2021-12-22T17:17:07.542Z", |
| 62 | + "subscriptionAlias": "string", |
| 63 | + "subscriptionInviteLastSentDate": "string" |
| 64 | + } |
| 65 | + } |
| 66 | + ], |
| 67 | + "nextLink": "string" |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +After we have the student IDs, we can begin deleting students from the lab. Replace the StudentID surrounded by <> in the below API call with the student ID obtained from the last step. |
| 72 | + |
| 73 | +```json |
| 74 | +DELETE https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<BillingAccountID>/billingProfiles/<BillingProfileID>/invoiceSections/<InvoiceSectionID>/providers/Microsoft.Education/labs/default/students/<StudentID>?api-version=2021-12-01-preview |
| 75 | +``` |
| 76 | + |
| 77 | +The API will respond that the student has been deleted: |
| 78 | + |
| 79 | +```json |
| 80 | +student deleted |
| 81 | +``` |
| 82 | + |
| 83 | +## Delete the lab |
| 84 | + |
| 85 | +After all of the students have been deleted from a lab, we can delete the actual lab. |
| 86 | + |
| 87 | +Call the endpoint below and make sure to replace the sections that are surrounded by <>. |
| 88 | + |
| 89 | +```json |
| 90 | +DELETE https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<BillingAccountID>/billingProfiles/<BillingProfileID>/invoiceSections/<InvoiceSectionID>/providers/Microsoft.Education/labs/default?api-version=2021-12-01-preview |
| 91 | +``` |
| 92 | + |
| 93 | +The API will respond that the Lab has been deleted: |
| 94 | + |
| 95 | +```json |
| 96 | +Lab deleted |
| 97 | +``` |
| 98 | + |
| 99 | +## Next steps |
| 100 | +In this article, you learned how to delete students from a lab and then delete the lab itself. Follow the tutorials below if you wish to create a new lab and read up on more documentation. |
| 101 | + |
| 102 | +- [Create a lab using REST APIs](create-lab-education-hub.md) |
| 103 | + |
| 104 | +- [Support options](educator-service-desk.md) |
0 commit comments