tools/rest-scripts/local.http (358 lines of code) (raw):
# -------HTTP REST CLIENT -------
# https://marketplace.visualstudio.com/items?itemName=humao.rest-client
#
# Purpose: Test the Local APIs.
@login_base = login.microsoftonline.com/{{TENANT_ID}}
@oauth_token_host = {{login_base}}/oauth2/v2.0/token
# -----------------------
# OAUTH CLIENT
# -----------------------
###
# @name login
@login_base = login.microsoftonline.com/{{TENANT_ID}}
@oauth_token_host = {{login_base}}/oauth2/token
POST https://{{oauth_token_host}} HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id={{CLIENT_ID}}
&client_secret={{CLIENT_SECRET}}
&resource={{CLIENT_ID}}
# -----------------------
# API Partition ** Requires Bearer Token only **
# -----------------------
###
@access_token = {{login.response.body.access_token}}
@HOST_IP = http://localhost:8080
@PARTITION_HOST = {{HOST_IP}}/api/partition/v1
@data_partition_id = opendes
###
# @name infoPartition
GET {{PARTITION_HOST}}/info
# Authorization: Basic user:password
Authorization: Bearer {{access_token}}
Accept: application/json
# x-payload: <jwt_section>
###
# @name createPartition
POST {{PARTITION_HOST}}/partitions/{{data_partition_id}}
Content-Type: application/json
data-partition-id: {{data_partition_id}}
{
"properties": {
"compliance-ruleset": {
"value": "shared"
},
"elastic-endpoint": {
"sensitive": true,
"value": "elastic-endpoint"
},
"elastic-username": {
"sensitive": true,
"value": "elastic-username"
},
"elastic-password": {
"sensitive": true,
"value": "elastic-password"
},
"cosmos-connection": {
"sensitive": true,
"value": "cosmos-connection"
},
"cosmos-endpoint": {
"sensitive": true,
"value": "cosmos-endpoint"
},
"cosmos-primary-key": {
"sensitive": true,
"value": "cosmos-primary-key"
},
"sb-connection": {
"sensitive": true,
"value": "{{ sb-namespace }}"
},
"sb-namespace": {
"sensitive": false,
"value": "mybus"
},
"storage-account-key": {
"sensitive": true,
"value": "storage-key"
},
"storage-account-name": {
"sensitive": true,
"value": "storage"
},
"storage-account-blob-endpoint": {
"sensitive": true,
"value": "storage-account-blob-endpoint"
},
"ingest-storage-account-name": {
"sensitive": true,
"value": "ingest-storage"
},
"ingest-storage-account-key": {
"sensitive": true,
"value": "ingest-storage-key"
},
"hierarchical-storage-account-name": {
"sensitive": true,
"value": "hierarchical-storage"
},
"hierarchical-storage-account-key": {
"sensitive": true,
"value": "hierarchical-storage-key"
},
"eventgrid-recordstopic": {
"sensitive": true,
"value": "eventgrid-recordstopic"
},
"eventgrid-recordstopic-accesskey": {
"sensitive": true,
"value": "eventgrid-recordstopic-accesskey"
},
"eventgrid-legaltagschangedtopic": {
"sensitive": true,
"value": "eventgrid-legaltagschangedtopic"
},
"eventgrid-legaltagschangedtopic-accesskey": {
"sensitive": true,
"value": "eventgrid-legaltagschangedtopic-accesskey"
},
"eventgrid-resourcegroup": {
"sensitive": true,
"value": "eventgrid-resourcegroup"
},
"encryption-key-identifier": {
"sensitive": true,
"value": "encryption-key-identifier"
},
"sdms-storage-account-name": {
"sensitive": true,
"value": "sdms-storage"
},
"sdms-storage-account-key": {
"sensitive": true,
"value": "sdms-storage-key"
},
"eventgrid-schemanotificationtopic": {
"sensitive": true,
"value": "eventgrid-schemachangedtopic"
},
"eventgrid-schemanotificationtopic-accesskey": {
"sensitive": true,
"value": "eventgrid-schemachangedtopic-accesskey"
},
"eventgrid-gsmtopic": {
"sensitive": true,
"value": "eventgrid-statuschangedtopic"
},
"eventgrid-gsmtopic-accesskey": {
"sensitive": true,
"value": "eventgrid-statuschangedtopic-accesskey"
},
"eventgrid-statuschangedtopic": {
"sensitive": true,
"value": "eventgrid-statuschangedtopic"
},
"eventgrid-statuschangedtopic-accesskey": {
"sensitive": true,
"value": "eventgrid-statuschangedtopic-accesskey"
},
"eventgrid-schemachangedtopic": {
"sensitive": true,
"value": "eventgrid-schemachangedtopic"
},
"eventgrid-schemachangedtopic-accesskey": {
"sensitive": true,
"value": "eventgrid-schemachangedtopic-accesskey"
},
"reservoir-connection": {
"sensitive": true,
"value": "reservoir-conn"
},
"indexer-decimation-enabled": {
"sensitive": false,
"value": "true"
}
}
}
###
# @name getPartitions
GET {{PARTITION_HOST}}/partitions/
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{data_partition_id}}
@partition = {{getPartitions.response.body.$[0]}}
###
# @name getPartition
GET {{PARTITION_HOST}}/partitions/{{partition}}
Authorization: Bearer {{access_token}}
Content-Type: application/json
###
# @name deletePartition
DELETE {{PARTITION_HOST}}/partitions/{{data_partition_id}}
Authorization: Bearer {{access_token}}
Content-Type: application/json
data-partition-id: {{data_partition_id}}
# -----------------------
# API: Entitlements
# -----------------------
###
@ENTITLEMENTS_HOST = {{HOST_IP}}/api/entitlements/v2
# -----------------------
# API: Version
# -----------------------
###
# @name entitlementsInfo
GET {{ENTITLEMENTS_HOST}}/info
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
###
# Get groups for the user encoded in the token
# @name myPermissions
GET {{ENTITLEMENTS_HOST}}/groups
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
x-user-id: {{CLIENT_ID}}
###
# Purpose: Initialize a Partition
# Istio Bypass: Yes - KV app-dev-sp-username value must be same as the x-user-id.
# @name tenantInit
POST {{ENTITLEMENTS_HOST}}/tenant-provisioning
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
x-payload: Bearer {{access_token}}
x-user-id: {{CLIENT_ID}}
# x-app-id: {{CLIENT_ID}}
# -----------------------
# API: Legal
# -----------------------
###
@LEGAL_HOST = {{HOST_IP}}/api/legal/v1
###
# @name info
GET {{LEGAL_HOST}}/info
Authorization: Bearer {{access_token}}
###
# @name getTagProperties
GET {{LEGAL_HOST}}/legaltags:properties
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
# -----------------------
# API: schema
# -----------------------
@SCHEMA_HOST = {{HOST_IP}}/api/schema-service/v1
###
# @name info
GET {{SCHEMA_HOST}}/info
Authorization: Bearer {{access_token}}
Accept: application/json
###
# @name getSchemaInfoList
GET {{SCHEMA_HOST}}/schema
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
###
# @name createSchema
PUT {{SCHEMA_HOST}}/schemas/system
Authorization: Bearer {{access_token}}
Content-Type: application/json
AppKey: None
{
"schemaInfo": {
"schemaIdentity": {
"authority": "osdu",
"source": "wks",
"entityType": "AbstractAccessControlList",
"schemaVersionMajor": 1,
"schemaVersionMinor": 0,
"schemaVersionPatch": 0,
"id": "osdu:wks:AbstractAccessControlList:1.0.0"
},
"createdBy": "OSDU Data Definition Group",
"scope": "SHARED",
"status": "PUBLISHED"
},
"schema": {
"x-osdu-license": "Copyright 2022, The Open Group \\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.",
"$id": "https://schema.osdu.opengroup.org/json/abstract/AbstractAccessControlList.1.0.0.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"x-osdu-schema-source": "osdu:wks:AbstractAccessControlList:1.0.0",
"title": "Access Control List",
"description": "The access control tags associated with this entity. This structure is included by the SystemProperties \"acl\", which is part of all OSDU records. Not extensible.",
"type": "object",
"properties": {
"owners": {
"title": "List of Owners",
"description": "The list of owners of this data record formatted as an email (core.common.model.storage.validation.ValidationDoc.EMAIL_REGEX).",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"
}
},
"viewers": {
"title": "List of Viewers",
"description": "The list of viewers to which this data record is accessible/visible/discoverable formatted as an email (core.common.model.storage.validation.ValidationDoc.EMAIL_REGEX).",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"
}
}
},
"required": [
"owners",
"viewers"
],
"additionalProperties": false,
"x-osdu-inheriting-from-kind": []
}
}
# -----------------------
# API: storage
# -----------------------
@STORAGE_HOST = {{HOST_IP}}/api/storage/v2
###
# @name info
GET {{STORAGE_HOST}}/info
Authorization: Bearer {{access_token}}
Accept: application/json
###
# @name getRecord
GET {{STORAGE_HOST}}/records/123
Authorization: Bearer {{access_token}}
Accept: application/json
data-partition-id: {{DATA_PARTITION}}
# -----------------------
# API: workflow
# -----------------------
@WORKFLOW_HOST = {{HOST_IP}}/api/workflow/v1
###
# @name info
GET {{WORKFLOW_HOST}}/info
Authorization: Bearer {{access_token}}
Accept: application/json
# x-payload: {{JWT_SECTION}}
###
# @name getAllWorkflow
GET {{WORKFLOW_HOST}}/workflow
Authorization: Bearer {{access_token}}
Content-Type: application/json
data-partition-id: {{data_partition_id}}
# x-payload: {{JWT_SECTION}}
###
# @name runWorkflowExecution
POST {{WORKFLOW_HOST}}/workflow/test_bash_operator/workflowRun
Authorization: Bearer {{access_token}}
Content-Type: application/json
data-partition-id: {{data_partition_id}}
{
"executionContext": {
}
}