FAQ: 403 Error Occurs When Importing Records via API Using PowerShell
## Answer
When using PowerShell's Invoke-WebRequest, requests may be blocked by WAF. In this case, please use one of the following methods:
1. Use a language such as Python
2. Use the sample script provided below
---
## Overview
In environments where WAF is deployed, the multipart/form-data format generated by PowerShell's Invoke-WebRequest may be blocked due to conflicts with WAF's strict validation rules. When this occurs, the API returns a 403 error. To avoid this issue, please use one of the following methods:
1. Execute the 「Import API Record」 using a programming language other than PowerShell, such as Python
2. If using PowerShell, execute the "Sample for Execution" provided below
## Sample for Execution (PowerShell version 6.0 or later)
##### PowerShell
```
$uri = 'https://pleasanter.net/fs/api/items/{サイトID}/import'
$filePath = './sample.csv'
$parametersJson = @{
ApiVersion = 1.1
ApiKey = '{APIキー}'
Encoding = 'UTF-8'
} | ConvertTo-Json -Compress
$curl = Join-Path $env:SystemRoot 'System32/curl.exe'
$response = & $curl `
-sS -f `
--form-string "parameters=$parametersJson" `
-F "file=@$filePath;type=text/csv" `
"$uri"
Write-Host $response
```
## Related Information
<div id="ManualList">
<article class="s-blog_list_unit"><h2>
<h2>The specified information was not found.</h2>
<p><a href="/ja/manual">Return to top</a></p>
</article>
</div><input id="SearchTextHidden" type="hidden" value="" />