Open Powershell, for example PowerShell 5 or 7 both x86 and x64 bits.
JSON output of all Joomla articles and their settings.
PowerShell 7.4.2: Invoke-RestMethod: Could not match accept header
PowerShell 5.1: Invoke-RestMethod: The remote server returned an error: (406) Not Acceptable
Windows 11 Pro 23H2 with PowerShell 7.4.2.
Joomla 4.4.4.
When using Postman I can get a connection, but via PowerShell it looks like Joomla don;t accept the application/json header.
I use PowerShell to do a lot of automations involving Joomla.
$token = <BEARER_JOOMLA_API_KEY>
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers = @{
'Authorization'='Bearer $token'
'Content-Type'='application/json'
}
$response = Invoke-RestMethod 'https://<DOMAIN_NAME>/api/index.php/v1/content/articles' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-06-01 13:39:59 |
Closed_By | ⇒ | rdeutz |
This doesn't looks like a bug, please use the forum.joomla.org for such questions