This endpoint allows you to create a new resource for any repository of class GeographicInformationSystem. The primary purpose is to specify which map layers (resources) in a GIS repository are relevent to the iTwin.
Id and displayName are required properties for the resource and must be unique to the repository. The response is a Resources object but will only have the id, displayName, class and subClass populated. The class and subClass values will be pulled from the repository.
Authentication
Requires Authorization
header with valid Bearer token for scope itwin-platform
.
For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.
Authorization
The user must have the itwins_modify
permission in order to create a repository resource for the iTwin.
Organization Administrators automatically get the itwins_modify
permission for every iTwin in their Organization. Organization Administrator are users with at least one of the following roles assigned in User Management: Account Administrator, Co-Administrator, or CONNECT Services Administrator. For more information about User Management please visit our Bentley Communities Licensing, Cloud, and Web Services wiki page.
Request parameters
The iTwin Id
The repository Id
Request headers
OAuth access token with itwin-platform
scope
Setting to application/vnd.bentley.itwin-platform.v1+json
is recommended.
Request body
iTwin-repository-resource-create
The resource id. Must be unique to the repository.
The resource name that should be displayed to the user. Must be unique to the repository.
Example
{ "id": "flood_zones", "displayName": "Flood Zones" }
Response 201 Created
Resource successfully created.
{ "resource": { "id": "flood_zones", "class": "GeographicInformationSystem", "subClass": "WebMapService", "displayName": "Flood Zones" } }
Response 401 Unauthorized
This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.
{ "error": { "code": "HeaderNotFound", "message": "Header Authorization was not found in the request. Access denied." } }
Response 403 Forbidden
The user is not authorized to create an iTwin Repository.
{ "error": { "code": "InsufficientPermissions", "message": "The user has insufficient permissions for the requested operation." } }
Response 404 Not Found
This response indicates that the specified repository was not found.
{ "error": { "code": "iTwinRepositoryNotFound", "message": "Requested iTwin Repository is not available." } }
Response 409 Conflict
iTwin Repository resource with the same id or name already exists.
{ "error": { "code": "iTwinRepositoryResourceExists", "message": "The specified iTwin Repository Resource already exists." } }
Response 422 Unprocessable Entity
Invalid request to create an iTwin Repository Resource. Review the 'Field Values' section near the top of this page.
{ "error": { "code": "InvalidiTwinsRequest", "message": "Cannot add iTwin Repository Resource.", "details": [{ "code": "MissingRequiredProperty", "message": "A required property is missing or empty.", "target": "id" }, { "code": "MissingRequiredProperty", "message": "A required property is missing or empty.", "target": "displayName" }, { "code": "InvalidValue", "message": "Id cannot be more than 200 characters.", "target": "id" }, { "code": "InvalidValue", "message": "DisplayName cannot be more than 200 characters.", "target": "displayName" } ] } }
Response 429 Too many requests
This response indicates that the client sent more requests than allowed by this API for the current tier of the client.
{ "error": { "code": "RateLimitExceeded", "message": "The client sent more requests than allowed by this API for the current tier of the client." } }
Response headers
Number of seconds to wait until client is allowed to make more requests.
iTwin-repository-resource-create
The resource id. Must be unique to the repository.
The resource name that should be displayed to the user. Must be unique to the repository.
{ "type": "object", "properties": { "id": { "type": "string", "description": "The resource id. Must be unique to the repository." }, "displayName": { "type": "string", "description": "The resource name that should be displayed to the user. Must be unique to the repository." } }, "additionalProperties": false, "example": { "id": "flood_zones", "displayName": "Flood Zones" }, "required": [ "id", "displayName" ] }
Resource
The resource Id. For example, for the iModels repository, this would be an iModel Id. For the CesiumCuratedContent repository, this would be the content Id. Each repository defines it's own id format. Treat it as a string and do not assume it will be a GUID or integer.
The resource class. This value is copied from the repository and may be empty.
The type of resource as specified by the repository. This is not a fixed list. The values are specific to each respository and not every repository will specify a resource type. In that case, the type property will not be included in the response.
The resource name that can be displayed to the user.
{ "type": "object", "required": [ "id", "displayName" ], "properties": { "id": { "type": "string", "description": "The resource Id. For example, for the iModels repository, this would be an iModel Id. For the CesiumCuratedContent repository, this would be the content Id. Each repository defines it's own id format. Treat it as a string and do not assume it will be a GUID or integer." }, "class": { "$ref": "#/components/schemas/ResourceClass", "description": "The resource class. This value is copied from the repository." }, "subClass": { "$ref": "#/components/schemas/ResourceSubClass", "description": "The resource class. This value is copied from the repository and may be empty." }, "type": { "type": "string", "description": "The type of resource as specified by the repository. This is not a fixed list. The values are specific to each respository and not every repository will specify a resource type. In that case, the type property will not be included in the response." }, "displayName": { "type": "string", "description": "The resource name that can be displayed to the user." }, "capabilities": { "type": "object", "required": [ "graphics" ], "properties": { "graphics": { "$ref": "#/components/schemas/GraphicsCapability" } }, "additionalProperties": false } }, "additionalProperties": false }
GraphicsCapability
A uri containing the location of the graphics content. This value can be cached but be aware that it might change over time. Some might contain a SAS key that expires after some time.
{ "type": "object", "properties": { "uri": { "type": "string", "description": "A uri containing the location of the graphics content. This value can be cached but be aware that it might change over time. Some might contain a SAS key that expires after some time." } }, "additionalProperties": false }
ResourceClass
The resource class.
{ "type": "string", "enum": [ "iModels", "RealityData", "CesiumCuratedContent", "GeospatialFeatures", "PdfPlansets", "GeographicInformationSystem" ], "description": "The resource class." }
ResourceSubClass
The resource subclass.
{ "type": "string", "enum": [ "WebMapService", "WebMapTileService", "ArcGIS", "UrlTemplate" ], "description": "The resource subclass." }
ResourceResponse
{ "type": "object", "properties": { "resource": { "$ref": "#/components/schemas/Resource" } }, "required": [ "resource" ], "additionalProperties": false }
Error
Contains error information.
One of a server-defined set of error codes.
A human-readable representation of the error.
The target of the error.
{ "type": "object", "description": "Contains error information.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error.", "nullable": true } }, "required": [ "code", "message" ], "additionalProperties": true }
Error Response
Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.
{ "type": "object", "title": "Error Response", "description": "Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.", "properties": { "error": { "description": "Error information.", "$ref": "#/components/schemas/Error" } }, "required": [ "error" ], "additionalProperties": false }
Was this page helpful?