question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to receive POST data for webservice?

See original GitHub issue

Hi, I’m trying to retrieve data from the body of a POST request.

Im defining the resource like this:

[ResourceMethod(RequestMethod.POST)]
public string UpdateData(string id)
{ ... }

I initially tried doing a post request like this: POST http://localhost:8080/data, and attaching a body like so:

{
    "id": "testID"
}

But querying id in the UpdateData method returned empty.

I can make this work if I were to query the uri like so: POST http://localhost:8080/data?id=testID However I’d like to make it so that I can actually put json data into here, which means attaching the data to the body like I would normally do with a POST request.

Can you let me know what I’m doing wrong? Much appreciated 😃

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DraconInteractivecommented, Jun 26, 2023

Can confirm, Unity was encoding the data in the backend, once I did it manually issue was all fixed.

Thanks again, love the package!

0reactions
Kaliumhexacyanoferratcommented, Jul 4, 2023

To be improved in #393

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Receive POST data on Web Service
I have a website which is supposed to receive data from a web form. I cannot access the code of the webform. I...
Read more >
REST: Can I use POST request to read data?
Yes, you can make it work at least using WCF, it's bit different in MVC and Web API where you add attributes to...
Read more >
How to get data from a webservice with POST method
I'm trying to get data from a webservice by using the POST-method (JSON formatted), the response would also be JSON. But executing the...
Read more >
Post Data using a Web Service - Solutions - AppMachine
Go to the "content" section of your app; · Click Add block. · Select the Pro tab. · Select the Web service block...
Read more >
POST data to webservice, receive answer ... and then
Hi, I wrote a sketch to post data to my webservice: String data = "param=hose&user=mi&value=10&p1=a&p2=b&p3=c"; char c = 'x'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found