In Windows 10, you cannot use the curl command.
This page explains how to contact the REST API in PowerShell using Invoke-WebRequest
.
# When a request body is required
When using an API that requires a request body, such as when creating LINE Things trial product information, enter the commands as shown below.
$channel_access_token = "{channel access token}"
$liffId = "{LIFF APP ID}"
$body = @{
name = "{trial product name}";
liffId = $liffId
} | ConvertTo-Json
$body = [System.Text.Encoding]::UTF8.GetBytes($body)
$response = Invoke-WebRequest -Method POST https://api.line.me/things/v1/trial/products `
-Headers @{
"Authorization" = "Bearer " + $channel_access_token;
"Content-Type" = "application/json"
} `
-Body $body
$response.Content
# When a request body is not required
When using an API that does not require a request body, such as when retrieving LINE Things trial product information, enter the commands as shown below.
$channel_access_token = "{channel access token}"
$response = Invoke-WebRequest -Method GET https://api.line.me/things/v1/trial/products `
-Headers @{
"Authorization" = "Bearer " + $channel_access_token
} `
$response.Content