|
| 1 | +--- |
| 2 | +title: "Update corsConfiguration_v2" |
| 3 | +description: "Update the properties of a corsConfiguration_v2 object." |
| 4 | +author: "dhruvinrshah" |
| 5 | +ms.localizationpriority: medium |
| 6 | +ms.subservice: "entra-applications" |
| 7 | +doc_type: apiPageType |
| 8 | +ms.date: 12/19/2024 |
| 9 | +--- |
| 10 | + |
| 11 | +# Update corsConfiguration_v2 |
| 12 | + |
| 13 | +Namespace: microsoft.graph |
| 14 | + |
| 15 | +[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)] |
| 16 | + |
| 17 | +Update the properties of a [corsConfiguration_v2](../resources/corsconfiguration_v2.md) object. |
| 18 | + |
| 19 | +## Permissions |
| 20 | + |
| 21 | +Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference). |
| 22 | + |
| 23 | +<!-- { |
| 24 | + "blockType": "permissions", |
| 25 | + "name": "corsconfiguration_v2-update-permissions" |
| 26 | +} |
| 27 | +--> |
| 28 | +[!INCLUDE [permissions-table](../includes/permissions/corsconfiguration_v2-update-permissions.md)] |
| 29 | + |
| 30 | +## HTTP request |
| 31 | + |
| 32 | +<!-- { |
| 33 | + "blockType": "ignored" |
| 34 | +} |
| 35 | +--> |
| 36 | +``` http |
| 37 | +PATCH /applications/{applicationObjectId}/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/applicationSegments/{applicationSegment-id}/corsConfigurations/{corsConfiguration_v2-Id} |
| 38 | +``` |
| 39 | + |
| 40 | +## Request headers |
| 41 | + |
| 42 | +|Name|Description| |
| 43 | +|:---|:---| |
| 44 | +|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).| |
| 45 | +|Content-Type|application/json. Required.| |
| 46 | + |
| 47 | +## Request body |
| 48 | + |
| 49 | +[!INCLUDE [table-intro](../../includes/update-property-table-intro.md)] |
| 50 | + |
| 51 | +|Property|Type|Description| |
| 52 | +|:---|:---|:---| |
| 53 | +|allowedHeaders|String Collection|The request headers that the origin domain may specify on the CORS request. The wildcard character `*` indicates that any header beginning with the specified prefix is allowed.| |
| 54 | +|allowedMethods|String Collection|The HTTP request methods that the origin domain may use for a CORS request.| |
| 55 | +|allowedOrigins|String Collection|The origin domains that are permitted to make a request against the service via CORS. The origin domain is the domain from which the request originates. The origin must be an exact case-sensitive match with the origin that the user agent sends to the service. | |
| 56 | +|maxAgeInSeconds|Integer|The maximum amount of time that a browser should cache the response to the preflight **OPTIONS** request.| |
| 57 | +|resource|String|Resource within the application segment for which CORS permissions are granted. `/` grants permission for the whole app segment.| |
| 58 | + |
| 59 | +## Response |
| 60 | + |
| 61 | +If successful, this method returns a `200 OK` response code and an updated [corsConfiguration_v2](../resources/corsconfiguration_v2.md) object in the response body. |
| 62 | + |
| 63 | +## Examples |
| 64 | + |
| 65 | +### Request |
| 66 | + |
| 67 | +The following example shows a request. |
| 68 | +<!-- { |
| 69 | + "blockType": "request", |
| 70 | + "name": "update_corsconfiguration_v2" |
| 71 | +} |
| 72 | +--> |
| 73 | +``` http |
| 74 | +PATCH https://graph.microsoft.com/beta/applications/{applicationObjectId}/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/applicationSegments/{segmentid}/corsConfigurations/{id} |
| 75 | +Content-Type: application/json |
| 76 | +
|
| 77 | +{ |
| 78 | + "@odata.type": "#microsoft.graph.corsConfiguration_v2", |
| 79 | + "resource": "/", |
| 80 | + "allowedOrigins": [ |
| 81 | + "" |
| 82 | + ], |
| 83 | + "allowedHeaders": [ |
| 84 | + "" |
| 85 | + ], |
| 86 | + "allowedMethods": [ |
| 87 | + "" |
| 88 | + ], |
| 89 | + "maxAgeInSeconds": 3000 |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | + |
| 94 | +### Response |
| 95 | + |
| 96 | +The following example shows the response. |
| 97 | +<!-- { |
| 98 | + "blockType": "response", |
| 99 | + "truncated": true |
| 100 | +} |
| 101 | +--> |
| 102 | +``` http |
| 103 | +HTTP/1.1 204 No Content |
| 104 | +``` |
| 105 | + |
| 106 | +<!-- |
| 107 | +{ |
| 108 | + "type": "#page.annotation", |
| 109 | + "description": "Update corsConfiguration_v2", |
| 110 | + "keywords": "", |
| 111 | + "section": "documentation", |
| 112 | + "tocPath": "", |
| 113 | + "suppressions": [ |
| 114 | + " |
| 115 | + Error: microsoft.graph.microsoft.graph/applications: |
| 116 | + /applications/{var}/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/applicationSegments/{var}/corsConfigurations/{var} |
| 117 | + Uri path requires navigating into unknown object hierarchy: missing property 'microsoft.graph.webSegmentConfiguration' on 'segmentConfiguration'. Possible issues: |
| 118 | + 1) Doc bug where 'microsoft.graph.webSegmentConfiguration' isn't defined on the resource. |
| 119 | + 2) Doc bug where 'microsoft.graph.webSegmentConfiguration' is an example key and should instead be replaced with a placeholder like {item-id} or declared in the sampleKeys annotation. |
| 120 | + 3) Doc bug where 'segmentConfiguration' is supposed to be an entity type, but is being treated as a complex because it (and its ancestors) are missing the keyProperty annotation. |
| 121 | + " |
| 122 | + ] |
| 123 | +} |
| 124 | +--> |
0 commit comments