I have a web application built upon Angular 5 and asp.net. My use case is that I need a demo version of this application which must have same UI interface/ Front-end logic but the data/response coming through web api's should change(Data being very confidential so this demo version is intended not to show that data).
I have lots of routes and around 40-50 api's from where data is received. Now, how can I change or jumble all of this data so that original data is not shown to user.
Till now I tried solving it using Angular interceptor, that is to intercept each response and then changing JSON values to something vague. As far as I can understand, I need a layer which can handle all responses and change those response to dummy data. Is this the right approach or we should handle it at back-end using asp.net?
Related
Hey I'm looking for some tutorials on how to consume an external Web API in ASP.NET MVC or if someone could explain briefly on how to go about it,specifically the https://platform.fatsecret.com/api/
You should check out RestSharp . It makes it very easy to consume an external API in your .NET application, since you can control how the API-response (JSON or XML) is deserialized to your model classes.
You can refer to the websites REST API Documentation on everything you need to include in your requests to their server. Here is an example of a method https://platform.fatsecret.com/api/Default.aspx?screen=rapiref&method=food.get
It breaks it down into what is required to be in your request and what you are to expect to see returned.
As for actual code, you have a few options. You can refer to Microsoft Docs in order to learn how to actually craft, send and receive requests to a REST API. The example shown uses the asp.net client Nuget package. It provides an object which allows you to easily create and receive requests.
Personaly, I like to practice with Postman for Chrome first. It allows you to easily create and receive REST data and even has an option to create template code from your request into multiple languages!
This might seem like an odd question and is probably very specific to our current requirements but I couldn't find anything through Google, so I thought I would give this a shot.
I am working in ASP.NET C# MVC4, and with a backend that is a legacy database system. We have two MVC projects; one for the API which interacts with the database and one for the front end which returns Views etc and interacts with the API. From the API, we are able to run subroutines that exist on the backend database server.
I am making an HTTP request from the front end to the API which contains JSON-encoded data. The API will use this to run a subroutine on the backend (the subroutine will save the data on the server and send out emails).
My question is this: What HTTP method should I use in this case?
For right now, I chose a POST request, and since this isn't an idempotent action, I think it is the best choice but it isn't really a CREATE operation, so I wanted to ask if anyone had any different advice.
I've built a REST API using web api 2 for handling the CRUD of my grid, this works fine. I'm trying to now implement SignalR for real time updates (doing something similar as described here Can I incorporate both SignalR and a RESTful API?) and it would appear that you MUST use the hubs for all server side operations when using a Kendo DataSource. I've been searching for some kind of example or documentation that allows for you to possibly use a REST API for CRUD but still allow the client to subscribe to a hub that will push data in real time when something happens with the data.
My question - Is this possible with the Kendo DataSource and if so how?
I am following the documentation here http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport.signalr for configuring SignalR on the client. Basically though what I would like to do is override the transport.signalr.server configs so that it keep talking to my REST API and just let the client subscribe to the hub so it can receive data in real time. Kendo's documentation is so sparse I can't tell if this is just not possible or if I'm missing something however.
I have coded a C# MVC5 Internet application and I have a Web API 2 web service that returns JSON data. I am retrieving this JSON data in an android application.
How can I add a feature to the web service such that only my android application can retrieve the JSON data? I am wanting to do this so that other web users cannot hammer the url and the web service will not send my data to unwanted applications and/or users.
Is this possible? If so, how should I do this?
Thanks in advance.
You have various ways to achieve this in fact.
For example, you can store a key in your android application and use send this key together with the request to your WebAPI. Your webAPI will than check if they key is valid and if it is, it will return the JSon.
However, there's no way to ensure that nobody else can request and get your data. For example by reverse engineering your android application and extracting the key, or by monitoring the network traffic and find the key in there.
You need to understand that there isn't anthing that guarantuees you 100% security.
See it as the following:
You have an open door right now, you can close it little by little, but closing and locking down is not possible. There will always be gap. A house also can't by made burglar proof, but you can make it very hard for a buglar to enter.
Go to this link Web Api. I have used the individual authentication for my web api. When you will register the user the response you will get is access token and use that access token as Authentication header in your ajax call if you are using Jquery ajax to call your Web Api. Refer this The OAuth 2.0 Authorization Framework. Hope this help you.
Are you looking for something like this?
http://httpd.apache.org/docs/2.2/howto/access.html
If you have other web server, there should be appropriate means to support such.
I am creating a few basic web services using c#, and I am trying to have the web service return back just a normal name=value&name=value without any kind of xml or json format. The legacy system hitting these services is fairly old and doesn't support xml or json. Is doing this possible?
If the legacy service that's targeting this web service is that old, how exactly are you calling the web service from it? It may be easier to create an .aspx page (or even better, .ashx) that parses the request and makes the response simply using Response.Write.
If you update your question/add a comment with the detail about how you're calling the service, I'll update my answer accordingly =)