39 Replies
"https://opendata-download-metanalys.smhi.se/api/category/pthbv1g/version/1/geotype/multipoint/from/2022/to/2023/period/monthly/data.json?epsg=4326&ll=16.527,59.382&var=p&var=t"
this is the api i cant make a call to it for some reason it just returns null
Show your code
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/When I'm running it myself I'm getting a
406 (GZIP encoding must be accepted)
response so... might be that?BlazeBin - odfvuslcwlnx
A tool for sharing your source code with the world!
BlazeBin - fxxibysrpqda
A tool for sharing your source code with the world!
my code so far
what exactly is null?
historicaldata returns null
thats blazor right?
yeah
not related to the problem but you should probably use an
ILogger
instead of Console.WriteLine
never touched blazor, but from online examples it looks like u have to the base's
OnInitializedAsync()
.
so sneak in an await base.OnInitializedAsync();
after line 53 where u set the field
i guess it would trigger a new render of the componentBlazeBin - mlmhfobnmpok
A tool for sharing your source code with the world!
my code now still doesnt work
and u get the correct json response?
dont think the json result is correct this is the result : " jsonResult "\u001f�\b\0\0\0\0\0\0\u0003=�MK�@\f����\u000e3�|���^�=xXJ)�\v�ʶ\nR��M�Kx¼/O�\u0015��r��=\u0001y��\a�;�\u0011\u001bE�d���Qm��S�F�\bw\a�����e�yټl^Vo��2M�s?���u|��]���x�62e�q��@\vχ�C\u001daC�����\u007f\u000f�_�\u007fX�2�\v�!�DE��my�65�k��Dbr\u001e#���Ed�-{���c��#l�\u0005��k�\u0011%�Q"��Cv\r�"5�D\fEV\nJ��LR��\u001dr��K\%�\u0012&y\vᯰ�\u001aC�\u0014�(\u001a=�⽑���>�f��]$ʬ����~\u0001��b��\u0001\0\0" string
"
yeah thats some binary data, not valid json, so something is wrong with the request itself
what does ur console say, does it throw an exception? or does it reach the "Failed to retrieve data" branch?
"blazor.server.js:1 [2023-09-14T10:11:16.427Z] Information: Normalizing '_blazor' to 'https://localhost:44306/_blazor'.
blazor.server.js:1 [2023-09-14T10:11:16.446Z] Information: WebSocket connected to wss://localhost:44306/_blazor?id=hi5I3tdzCHvQZ6Xo9YE-pw.
browserLink:3299 [Deprecation] Listener added for a synchronous 'DOMNodeInserted' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
Dv @ browserLink:3299
DevTools failed to load source map: Could not load content for chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/content-script/contentScript.js.map: Systemfel: net::ERR_BLOCKED_BY_CLIENT
DevTools failed to load source map: Could not load content for chrome-extension://bmnlcjabgnpnenekpadlanbbkooimhnj/browser-polyfill.js.map: Systemfel: net::ERR_BLOCKED_BY_CLIENT"
this is my console
wait it has to reach the exception
the above is my console
tbh im not sure where ur logs end up, doesnt seem like its in that console
are you available for a call?
sorry, nope
dam
the only other difference i see to online examples is, that u have a private field, while examples use properties, but i doubt its that.
cap5lut
REPL Result: Failure
Exception: HttpRequestException
Compile: 452.083ms | Execution: 1006.063ms | React with ❌ to remove this embed.
that seems to be ur problem, its compressed
cap5lut
REPL Result: Success
Result: string
Compile: 508.828ms | Execution: 1336.028ms | React with ❌ to remove this embed.
yeah u need to set up automatic decompression
yeah it worked ❤️
thanksss
how did u know that
i mean how did u get to the result
well, we saw already that its binary data.
then from the first eval the error message:
Response status code does not indicate success: 406 (GZIP encoding must be accepted).and then i quickly googled how to use httpclient with gzip decompression ;p
I mean, Thinker said that in the first messages of this thread
https://discord.com/channels/143867839282020352/1151809075458347038/1151813882185256961
Thinker
When I'm running it myself I'm getting a
406 (GZIP encoding must be accepted)
response so... might be that?Quoted by
<@105026391237480448> from #Need help with api call (click here)
React with ❌ to remove this embed.
oh i totally missed that message >.<
"well, we saw already that its binary data.
then from the first eval the error message:
Response status code does not indicate success: 406 (GZIP encoding must be accepted).
and then i quickly googled how to use httpclient with gzip decompression ;p"
where can i see messages like this never saw it
binary data
the eval with the error message
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.