Angular 5 - Receive POST requests - html

Scenario: My angular page should be receiving a POST request with JSON data from SpringBoot API.
Consider this as a work example: When client clicks on login on an angular webpage, the login info would be sent through JSON to SpringBoot where it will validate the user,if it returns true, the same JSON would then be forwarded back to webpage as POST, where it will be captured and then worked on(displayed for example).
Now, as per this link, it is said that POST requests cannot be received on Angular but need Express for the same. Is it true? or is there any other way to receive POST requests from API using Angular? I'm googling on this from many days and haven't found anything relevant that confirms this and needed a closure.

Angular is a library for providing a user interface in a browser (which is a type of HTTP client).
To listen for an HTTP request you need an HTTP server (such as Apache HTTPD, Lighttpd, NGINX, something built with Node.js+Express, etc, etc, etc).
is there any other way to receive POST requests from API using Angular?
No
should be receiving a POST request with JSON data from SpringBoot API.
Spring is a Java framework for running a webservice.
Typically it receives HTTP requests and makes HTTP responses.
While you could make HTTP requests from it (i.e. when a client makes an HTTP request to a Spring API, the Spring API then makes an HTTP request to another web service and uses the data in the response to construct its own response to the original request)…
… it sounds like you have the wrong end of the stick and really need to make an HTTP POST request from Angular to Spring and then read the HTTP response in Angular.
i.e. Ajax.

Related

HTTP request requiring cookie

I am attempting to replicate a HTTP Request to a Google Analytics endpoint -
https://analytics.google.com/analytics/app/data/admin/annotations?dataset=XXXXXX&hl=en_US&state=app.admin.annotation.table
The endpoint itself returns a JSON string that i want to use and in this case it is returning the Annotations used in GA itself.
I've been able to capture the HTTP request using Postman and i then used Fiddler to work out why postman wasnt working. It ended up being the cookie needing to be set.
As i want to automate the extraction of this JSON string, i can't provide a cookie each time. Is there any way around this?

How to make json rpc request in Django?

I have to create a web panel for Voipswitch by using their API provided on this website. Visit to take a look at the api. They use json rpc 2.0 which I've never used before. How can I make requests in json rpc using Django as my framework for the panel?
I can capture the post data from users, but how do I implement it in an api call?
Use the 'requests' package, or urllib2
https://pypi.python.org/pypi/jsonrpc2
http://docs.python-requests.org/en/latest/

How to send hastag access_token posted by url to server inorder to use it further

I will explain in detail, I am trying to authorize the youtube my webapp. For that I post as below
https://accounts.google.com/o/oauth2/auth?
client_id=1084945748469-eg34p0an9fut6urp5.apps.googleusercontent.com&
redirect_uri=http://www.abc.com/site/video&
scope=https://gdata.youtube.com&
response_type=token
And youtube respond that request by JSON object
http://www.abc.com/site/video#access_token=ya29.AH6RkxRG81F7H9vZLcA4wmzzzgJlmBSduk-oDxom5w&token_type=Bearer&expires_in=3600
Now I want to send the access_token since this is hastag data I can't access it anyway using php on server side, I know I have to send it to server using AJAX or JSON somehow. Also I am using Yii framework if there is some Yii method I would be happy to use. If no choice I will use

How to get mosync app to use RESTful APi and json payload

I have written a mosync application that interacts with a REST we service. I am using the AMDownload package. Wat is the right way to send the json payload required by the REST API?
The HTTP 400 Bad Request perhaps happens because the MoSync Android runtime messes up the URL, causing the server to return this error. Alternatively, perhaps the MoSync Android runtime considers the URL to be wrong, and sends back the HTTP 400 Bad Request.
Is it possible for you to test on an Android device? To see if the result is the same.
Also, is it possible to find the exact URL/data sent to the server? Perhaps using some network monitor software. If you have access to the server, can you see the request it receives? If you would enter the same request in a client like the Firefox RESTClient, do you get the same response?

Consume JSON in body of POST Request from ASP.NET

I need to be able to consume some JSON data in a POST request from another web app. I have tried looking at the various methods on the Request class, but nothing seems to give me the JSON I need.
Using Request.Form will not work, since it is not coming from a form, but another web app. The content type is application/json, and from examining the whole HTTP request, I know the JSON is in there. What is the best way to get at this JSON data?
Note: I am working from within an action on a controller.
I think you can get your JSON from your model parameter inside the Action of the Controller. Check out this article that explains a bit of what I mean.
You can also read this one for reference
Since you are consuming data from another web app I would use a REST web service instead of a controller in an MVC application. You cans use the ASP.NET Web API which makes it easy to setup a REST web API and it is tightly integrated in with MVC 4, which is now in Beta. If the communication is cross domain (i.e. different servers and/or ports) you will need to use JSONP. You can go to this StackOverflow QA for directions on how to use JSONP with Web API.