Send HTTP Requests (MEAN stack) - api

I am working with MEAN stack (MongoDB , ExpressJS, AngularJS and NodeJS). I know how are GET,POST,DELETE and PUT handled in the server side but problem comes from the client side. For example - given a button "Register" I want to send a POST req but I don't know how. I only need explanation - not any code or something else. Help is greatly appreciated :)

Angular provides $http module which you can use in your client code to make GET, POST, PUT and DELETE operation.
On your html, you should have a listener(by using ng-click if you are using angular) for "Register" Button. In your function definition you can use $http.post(<url>, <data>) to make a request.
Here is the relevant video tutorial of probably what you are trying to acheive https://egghead.io/lessons/angularjs-http

Related

How do I use/read an api documentation to send a simple request?

I know this is probably strictly case-specific, but I do feel like I encounter this problem a lot so I will make an effort to try and understand it better.
I am new to using APIs, but I have never succeeded in using one without copying someone's code. In this case, I can't even find any examples on forums, nor in the API documentation.
I'm trying to pull my balance value from my investment bank "NordNet" to scroll, amongst other things, on an Arduino display I've made. Right now I use python Selenium to automatically but "physically" login to NordNet and grab my balance from the DOM. As I'm afraid I might get "punished" for such botted behavior, and because the script is fairly high maintenance (as the HTML changes over time), I would obviously much rather get this information through NordNet's new API.
Link to NordNets API doc
Every time I try to utilize an API doc it's always the same, it looks easy, but I can never get it to work.
This time I tried to just play a little with the API before exploring further.
I use PostMan to send the simplest request:
https://www.nordnet.se/api/2
And I get a successful code 200 JSON response.
I then try to take it a step further to access my account data using this endpoint:
https://www.nordnet.se/api/2/accounts
For this one, I obviously need some authentication of some sort
The doc looks like this:
So I set my PostMan client up like this and get the response showcased:
I've put my NordNet login into the "Auth" tab as "basic auth" and I then see PostMan encrypts this info some way, in the "Headers" tab.
I'm getting an unauthorized response code and I have no idea why. Am I using PostMan wrong (probably)? Is the API faulty (probably not)? There is a mention of a session_id that should contain both password and username? Maybe something completely else...
I hope you can help
The documentation says to use session_id as username and password for that api ,
so try logging in and then get the session id (try with both sid and ssid) . from network tab and pass it as username and password for authorization .
sid- is for http and ssid for https i guess , try with both

Kucoin Exchange Kline Get API Response is wrong

hey guys does somebody know why i dont get the correct response from thhis api call:
https://api.kucoin.com/v1/open/kline?symbol=LTC-BTC&type=1hour&from=1517446866&to=1518311025&limit=1000
it should give me normaly a couple of candelstick data back
i have code already for other exchanges with her api and did not have problems
but this one i dont know if i make somethink wrong or maybe the api from this exchange have a error
the documentation site is this: https://kucoinapidocs.docs.apiary.io/#reference/0/market/get-kline-data(open)
You are using an outdated API.
KuCoin switched to TradingView as its chart software. This is why you have https://www.kucoin.com/#/trade.pro/LTC-BTC as the default view for trading. You can still access the old view via https://www.kucoin.com/#/trade/LTC-BTC.
Looks like the API call you are using was made for the old version.
Use this URL instead:
https://api.kucoin.com/v1/open/chart/history
Working URL:
https://api.kucoin.com/v1/open/chart/history?symbol=LTC-BTC&type=1hour&from=1517446866&to=1518311025&limit=1000
For more information about the new API call: (notice how it says tradingview-version!)
https://kucoinapidocs.docs.apiary.io/#reference/0/market/get-kline-data(open,-tradingview-version)

Is it possible to look at a URL and determine if it's using Struts?

example:
http://www.boston.com/travel?p1=Levelone_Nav_travel
will we be able to say if this website code is developed using Struts framework ? If so how, details please.
Not necessarily.
The HTTP headers sometimes include relevant information, but not reliably.

Tumblr Follow Api

I am trying to to add a custom Tumblr follow button to my site and I've been trying to figure out how the follow api works.
I've been using https://apigee.com/console/tumblr to test various requests and so for I can make the get requests work, but not the post requests. Specifically, I would like to be able to follow a blog.
For instance, if i want to follow mcupdate The post request should look like this
http://api.tumblr.com/v2/user/follow?url=http%3A%2F%2Fmcupdate.tumblr.com
This returns 404 page not found. As do any and all variations that I can think of. Since the get requests work fine, I am assuming that the credentials that apigee.com generates are fine. Does anyone know what is the problem?
Thanks.

Can't send data via xmlhttp

I could use xmlhttp and asptear or any other components to post data to external sites on WINDOWS 2003(iis 6).
not i am using 2008 server(iis 7) and i can't get worked that components to send data.
could you please guide me ?
(PS. components are tearing the pages but don't send post data, seems like tear as GET method)
You want to post from a server-side language running on IIS? ASPTear is for classic ASP so assuming that:
ASPTear supports POST, it just defaults to GET.
You could also use "Msxml2.ServerXMLHTTP" (example).