No Code Attached Yet
avatar SoundHunter1
SoundHunter1
20 May 2024

Steps to reproduce the issue

Open Powershell, for example PowerShell 5 or 7 both x86 and x64 bits.

Expected result

JSON output of all Joomla articles and their settings.

Actual result

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

System information (as much as possible)

Windows 11 Pro 23H2 with PowerShell 7.4.2.
Joomla 4.4.4.

Additional comments

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.

Used code:

$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
avatar SoundHunter1 SoundHunter1 - open - 20 May 2024
avatar joomla-cms-bot joomla-cms-bot - change - 20 May 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 May 2024
avatar SoundHunter1 SoundHunter1 - change - 20 May 2024
The description was changed
avatar SoundHunter1 SoundHunter1 - edited - 20 May 2024
avatar rdeutz rdeutz - close - 1 Jun 2024
avatar rdeutz
rdeutz - comment - 1 Jun 2024

This doesn't looks like a bug, please use the forum.joomla.org for such questions

avatar rdeutz rdeutz - change - 1 Jun 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-06-01 13:39:59
Closed_By rdeutz

Add a Comment

Login with GitHub to post a comment