GithubHelp home page GithubHelp logo

Comments (16)

SamKr avatar SamKr commented on July 21, 2024

Found this in the dev blog: api changes

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

Actually I don't think the api changes are relevant. When I use curl to fetch the json, using the same uri and bearer, it works and I get a json string. When I deserialize that, using the classes in your project, it works.

When I extend your library to include the restsharp error message, it gives this:

Error: Found invalid data while decoding.

At a loss why it's saying that though. Any idea?

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

Ended up extending your library to use a curl fallback in case restsharp fails, which works fine for now.

from hadotnet.

neodd70 avatar neodd70 commented on July 21, 2024

I'm experiencing the same problem.

from hadotnet.

PockyBum522 avatar PockyBum522 commented on July 21, 2024

I'm experiencing this as described above. @SamKr can you share your fork that works?

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

Sure @PockyBum522, will do tomorrow.

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

Here you go @PockyBum522 : HADotNet fork.

Please read the readme for instructions. Let me know if it doesn't work for you.

from hadotnet.

PockyBum522 avatar PockyBum522 commented on July 21, 2024

Thank you very much! I'll have a chance to test today.

from hadotnet.

qJake avatar qJake commented on July 21, 2024

@SamKr What platform/OS are you running on? curl isn't a Windows thing so I'm assuming you're on something else?

RestSharp may have issues on other platforms and that could be the cause. I can try bumping up RestSharp's dependency version to see if that resolves it.

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

I'm using Windows, curl is available for windows: https://curl.se/windows/

from hadotnet.

qJake avatar qJake commented on July 21, 2024

Well sure, but not out of the box and not (easily?) as a NuGet dependency... so CliWrap fails if you didn't go out of your way to install curl manually. 😉

In any case, this looks like a bug with 0.118.x, I'll take a look and see if I can find out what changed.

Worst case, I can enhance that error message - response codes of 0 indicate a network issue of some kind, for which there's an error message that should be printed out in those cases.

from hadotnet.

SamKr avatar SamKr commented on July 21, 2024

Curl is a stand alone exe, so as long as I provide it along with the project's executable it's fine. And it's a backup method which is working fine for now.

I tried bumping restsharp and looking what's happening, but didn't get much result. Hopefully you'll do better :)

from hadotnet.

KoalaBear84 avatar KoalaBear84 commented on July 21, 2024

Why use Curl when you can use HttpClient? I don't understand. The REST API still works without any issues with HttpClient.

Ahh, nvm, probably because there is an issue in RestSharp.. Which is able to use a fallback.

from hadotnet.

Trozmagon avatar Trozmagon commented on July 21, 2024

The Curl solution doesn't work when performing Posts, any updates on a RestSharp solution?

from hadotnet.

Trozmagon avatar Trozmagon commented on July 21, 2024

Can confirm a basic HttpClient is working just fine:

var client = new HttpClient { BaseAddress = new Uri(""), Timeout = new TimeSpan(0, 0, 0, 0, -1) };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "
***");

var request = new HttpRequestMessage(HttpMethod.Post, "/api/services/media_player/volume_up");
request.Content = new StringContent("{"entity_id":"media_player.living_room_speaker"}", Encoding.UTF8, "application/json");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

await client.SendAsync(request).ContinueWith(r => {
Console.WriteLine("Response: {0}", r.Result);
});

from hadotnet.

qJake avatar qJake commented on July 21, 2024

Version 1.4.0 has just been pushed out to NuGet that addresses this. Closing this issue.

from hadotnet.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.