Tech Cruize
Tech Cruize

Reputation: 107

Create Easy Tables with Power script

is there any way of defining Easy Tables through PowerShell rather than the JS file.?

Any Examples for creating Easy tables through CSV OR Documentation about defining through JS file would be helpful.

Upvotes: 0

Views: 72

Answers (1)

Tom Sun
Tom Sun

Reputation: 24549

We could use the Rest API to create the Easy table and import data to the easy table. I test it with Postman.

Create easy table

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/tomtestmobile/extensions/Microsoft.Mobile.Management/tables?api-version=2014-11-01

body sample:

{"name":"tableName","permissions":[{"name":"read","level":"anonymous"},{"name":"insert","level":"anonymous"},{"name":"update","level":"anonymous"},{"name":"delete","level":"anonymous"},{"name":"undelete","level":"anonymous"}],"links":[],"insert":"","update":"","delete":"","read":"","undelete":"","hasCustomPermissions":false,"extendedSettings":{"softDelete":true},"columns":[{"name":"Team","type":"String"},{"name":"Product","type":"String"},{"name":" name","type":"String"}]}

enter image description here

Import data enter image description here

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/tomtestmobile/extensions/Microsoft.Mobile.Management/tables/JustForTest3/data?api-version=2014-11-01

body sample:

{"csvData":"Team,Cover Product, name\r\nCloud,Azure ,tom"}

Plesae use the following code the invoke rest API in the Powershell. How to get the authorization, you could refer to this video.

  $body = "jsonstring"
  $hdrs = @{}
  $hdrs.Add("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1d...")
  Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $hdrs

Upvotes: 1

Related Questions