Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I created a PowerBI streaming datasource API with a URL and desired data in the following format:
[ { "Variable 1" :98.6, "Variable 2" :98.6 } ]
Here are two different ways I have tried to code this:
This gives me an error of: The type name 'Post' does not exist in the type 'UnityWebRequest'.
The other way I do it is to change PostData to use UploadHandlerRaw:
I apologize for the lengthy post but I have been trying to figure this out for weeks now.
UPDATE: I have tried deleting the "new" from the UnityWebRequest.POST line and I now get an 500 Internal Server Error.
TLDR: I can only POST from Postman and Powershell, not any other API requests, and I can't do anything from Unity. Any and all help is greatly appreciated.
Thank you so much for the reply. I have been adding the push key to the URL as given from the Power BI API info in the following manner:
https://api.powerbi.com/beta/<tenant id>/datasets/<dataset id>/rows?<rows>key=<push key>
So I am not sure if this is the problem. Maybe I need to add more headers to the API request? Apologies, I am not well versed in APIs.
you can't add the rows to the URL. those need to go into the request body, and the request must be POST, not GET.
Like I showed in my sample code
I have previously been using POST as you suggested, I just now changed the URL to "rows?key=<push key>" so I have deleted the information PowerBI put in the URL with the rows information, however I still get a 500 Internal Server Error. Your sample code is informative but because I am using Unity, there is a different way I am uploading the data with .ToJson and Unity Web Requests as seen in my question post. I really appreciate your patience with me, I have been trying to figure this out for weeks.
You can use Postman or the API sandbox to figure out what the issue with your payload is.
This url is for push datasets, but the mechanics are the same as for streaming datasets (minus the key)
Push Datasets - Datasets PostRowsInGroup - REST API (Power BI Power BI REST APIs) | Microsoft Learn
If you can show a sample payload and the definitions of your streaming dataset fields I may be able to help you further
It works when I use Postman to POST the following content:
When I print out my player data in JSON format, I get the following output:
{"Experience":3, "Confidence":5}
The full stacktrace for the 500 error is:
Error: HTTP/1.1 500 Internal Server Error
0x00007ff729478e4d (Unity) StackWalker::GetCurrentCallstack
0x00007ff72947ddf9 (Unity) StackWalker::ShowCallstack
0x00007ff72a44b121 (Unity) GetStacktrace
0x00007ff72ab0d922 (Unity) DebugStringToFile
0x00007ff7283c97f6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000002627cb5d403 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000002627cb5d31b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000002627cb5d020 (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x000002627cb5cee8 (Mono JIT Code) UnityEngine.Debug:Log (object)
0x000002627cb5cd33 (Mono JIT Code) APIPost/<PostData>d__10:MoveNext () (at C:/Users/ellai/My project (1)/Assets/API_Post.cs:73)
0x000002617fc16470 (Mono JIT Code) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
0x000002617fc1659f (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_intptr (object,intptr,intptr,intptr)
0x00007ff9d943e0d4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff9d937eb74 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ff9d937ed0c (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff729397bc4 (Unity) scripting_method_invoke
0x00007ff729376844 (Unity) ScriptingInvocation::Invoke
0x00007ff72933f32a (Unity) Coroutine::Run
0x00007ff72933cd1f (Unity) Coroutine::ContinueCoroutine
0x00007ff728ff9ef3 (Unity) AsyncOperation::InvokeCoroutine
0x00007ff729934f8c (Unity) UnityWebRequestAsyncOperation::InvokeCoroutine
0x00007ff729935171 (Unity) UnityWebRequestProto<UnityWebRequestTransport,AtomicRefCounter,RedirectHelper,ResponseHelper,DownloadHandler,UploadHandler,CertificateHandler,HeaderHelper,AsyncOperation>::Job_InvokeCoroutine
0x00007ff728fad63a (Unity) BackgroundJobQueue::ExecuteMainThreadJobs
0x00007ff72902fb1c (Unity) `InitPlayerLoopCallbacks'::`2'::EarlyUpdateExecuteMainThreadJobsRegistrator::Forward
0x00007ff72900fbda (Unity) ExecutePlayerLoop
0x00007ff72900fd66 (Unity) ExecutePlayerLoop
0x00007ff729016625 (Unity) PlayerLoop
0x00007ff729fd2cbf (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff729fdf89d (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff729fddba1 (Unity) Application::TickTimer
0x00007ff72a45180a (Unity) MainMessageLoop
0x00007ff72a456910 (Unity) WinMain
0x00007ff72b84133e (Unity) __scrt_common_main_seh
0x00007ffab28c257d (KERNEL32) BaseThreadInitThunk
0x00007ffab3d0aa78 (ntdll) RtlUserThreadStart
Is Unity maybe confused by the 401 ?
When I use Postman to test a GET request, I get the following error:
so it seems like it must be an issue with Power BI perhaps redirecting to this second URL?
Redirects can happen, but maybe Unity didn't expect that?
I tried using the redirect URL 'http://wabi-west-us-b-primary-redirect.analysis.windows.net/beta/c6f643f0-4f6b-47f1-90f2-d2ce068e698...<dataset>/rows?key=<key>'." in Postman for a POST request but it gets stuck sending the request for 30 seconds then times out. Is there anywhere I can see the proper redirect URL?
Not clear to me what you are trying to accomplish. Are you attempting to push rows into a streaming dataset?
Yes, I am trying to push data from Unity into a streaming data set so that there is a new row in the streaming dataset. In the code above I have hard coded the data to have "Experience" = 3 and "Confidence"= 5 which is what I would like the row to display after the Unity Web Request completes. However, I either get a 500 Internal Server Error or a 404 error.
To push rows into a streaming dataset you need to add the push key to the URL.
$endpoint = "https://api.powerbi.com/beta/<tenant id>/datasets/<dataset id>/rows?key=<push key>"
Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
User | Count |
---|---|
9 | |
1 | |
1 | |
1 | |
1 |