Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

API - Keyblocker

Hello,

 

I am trying to run a powershell script to call the API for our ticket system, and then post hit to PowerBI with a foreach loop for every ticket, total is about 17k tickets. 

 

This is the message I am recieving when trying to my script. 

Invoke-RestMethod : {"error":{"message":"The request was blocked by KeyBlocker "}}
At line:9 char:1
+ Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Has anyone seen this, and is there a workaround?

6 REPLIES 6
Jayendran
Solution Sage
Solution Sage

Hi @Anonymous ,

 

Are you invoking this behind any corporate firewall ?

 

Also make sure that you have run this using TLS 1.2 in your script

 

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Anonymous
Not applicable

Sorry for the late reply, I solved this by putting every ticket into one foreach loop. 

Anonymous
Not applicable

Can you please share with us a little bit more details on the workaround you've used?

Anonymous
Not applicable

Hi @Anonymous!

 

Ofcourse, what I do have today is a powershell script that runs a api call to our ticket system, collecting all tickets into a PowerShell variable, from here I wanted to post one and one ticket to a PowerBI dataset trough the API - thats where I got rate limited by Microsoft and got the Keyblocker error message.

 

What I did from here was to instead of posting each ticket with a api call I added a append to variable inside the foreach loop, and then posted everything inside this variable to the PowerBI dataset. This can only contain 10 000 objects, so I had to split it into two api calls. Does this help a bit? 

Do you happen to still have this code and is so, would you be willing to share? I am running into this same issue and am having trouble fixing it. 

HI
Im new to powershell and I keep on getting the key Blocker message.
Please could you assist in sending your sample code please.

Data is extracted from SQL server. Ho do you add all the records and pass the result once.

 

section of the code that im bateling with


while ($dataset.Read()) {
$payload = @{
"PLR_Description" =$dataset['PLR_Description']
"Snap" =$dataset['Snap']
"LastCreated" =$dataset['LastCreated']
"Total" =$dataset['Total']
"Success" =$dataset['Success']
"Failure" =$dataset['Failure']
"e Disconnect" =$dataset['e Disconnect']
"e CRC Failed" =$dataset['e CRC Failed']
"e Resent count exceeded" =$dataset['e Resent count exceeded']
"e Invalid Tag" =$dataset['e Invalid Tag']
"e PLR: no space for message" =$dataset['e PLR: no space for message']
"e PLR: old pocsag timestamp" =$dataset['e PLR: old pocsag timestamp']
"e PLR: RTC Invalid" =$dataset['e PLR: RTC Invalid']
"e GW: ReceivedByteCount" =$dataset['e GW: ReceivedByteCount']
"Type" =$dataset['Type']
"Diff" =$dataset['Diff']
}

Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
}
$connection.Close();
$connection.Dispose();

 

 

 

Thank you

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors