API Call via Powershell

Hello,
i need a code example for an API Call in Powershell. I am new and not sure how to create a correct API call with authentication.

I have created an API Key and a Client Secret.

It would be nice to create an example for a call of all projects.

I thought about using the Invoke-RestMethod of Powershell (Invoke-RestMethod (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn) near to this:

$headers = @{
    Authorization: Bearer {api_key}
}
Invoke-RestMethod -Uri "https://api.awork.com/api/v1/projects" -Method Get -Headers $headers 

I need an fully functional example for orientation.

Thanks!

Hi @it1, again, I’m not experienced with Powershell, but maybe you can try to create the requests in some tool like Postman or Insomnia, make sure it works, and then export the request for Powershell? Insomnia has a feature for this. Alternatively, try to create a cURL with the request and ask ChatGPT to translate it for Powershell.

Here is how to do this in Insomnia.