Restful asp.net api and using json in android application - c#

I use this tutorial to create a restful asp.net web api for my android application, everything goes well and seems well, but my android application (based on tutorial part 2) can't communicate with db and always return 0 when I fetch some data.
I should mention that I use linq for connecting to db and in my api service I return a list of object (List)...
I need some way to test my api , is there anyway?! For example call api from browser or something like that to see the json array that return...
Also I have a question about the dll in the tutorial. Are they safe and okey?!
If anyone have better solution to have the functionality like the tutorial ones please suggest me...
Thanks in advance.

Related

How to migrate existing Asp.net application to WebApi

Hello Stackers,
I have an Asp.net Mvc and i wanna migrate the index page from it to an Web Api
i wanna know if there is any pattern or approach to follow for making it more easy.
i google it but i didn't found a useful answer.
Any answer will be appreciate it.
Thanks
I am not sure if there is a pattern, but next some steps that could help.
Group all your services that returns, saves, delete or do some work in the backend. On your backend you could create a new layer (New project or new namespace) to call the existing ones and export those services as Web API endpoints.
On your frontend check how are you going to consume your Web API services. I mean if you are going to call it directly with javascript or maybe using some library or framework.
Those are going to be the first steps.

VirtoCommerce Store Front Where dose it get the data

Hello VirtoCommrece People its an honor working with such product,
its a bit complex to me at my level so please forgive me if im asking some basic newbe questions ,
how dose the data comes from the platfrom to the api ?
i tried to delete the _workcontext from the index action nothing happen
i deleted the angular services the images gone but the data stayed so can anyone tell me
?
As I can understand, you're interesting in how data comes from platform to storefront. Storefront has auto-generated code (by AutoRest util from Microsoft) to call platform RESTful API from C#. This APIs called via frontend user with special api key. You can find more info here:
Working with Platform API
How to generate module API C# client using AutoRest

Returning JSON from WCF after POST in Android

I just started coding for my android application and I am unsure of how I should start coding.
If I want to do lets say a login in my android application. How should i start?
Is it possible if I do it in this way:
Send POST to my WebService > Web Service Validates credentials > Return user information
Please help!
Yes your process is correct.
If you have simple needs like what you describe using the default serializer should be enough, just specify:
WebMessageFormat.Json
Later if you need a full fledged JSON library use Json.NET
A small tutorial to get you started (it uses a similar use-case): http://www.codeproject.com/Articles/167159/How-to-create-a-JSON-WCF-RESTful-Service-in-60-sec
Do not forget to use authentication over HTTPS only...

asp.net - Get data from external application

I would like to know how to link my web application with an external application.
The external application would call my application with a link.
Ex, ../../report/3
here 3 is the id for some data. Now I would gather the data from their database and process it.
Please tell me how to achieve this. What would be the best approach?
I am not started yet. Looking for an idea to start.
Thanks in advance.
Read about RESTfull services and JSON.
Alternatively you can return a JSON (or XML) according to a query string sent from a client.
If you want some security read about WCF and for older .net you can check out the older Web Services of asp.net
Good luck

What web service to implement so it's easy to read from an iphone application?

I want to develop a web service that will enable me to synchronize the databases of my iphone app with a main database.
I will be using c# to write this web service. What kind of web service should I write, and how should it look like for it to be easy to call from the iphone application?
To answer the comment question: I think would prefer XML
REST webservice with JSON. It will be easier to read from iphone app. iPhone interaction with ASP.NET WebService
Also see this for tutorial http://www.codeproject.com/KB/webservices/RestWebService.aspx
You can't go wrong with WCF.
It's recommended by microsoft for all web services (outside the MVC world) and supports many different scenarios and interop. For an easier (but more fragile and less versatile) solution you would go with an aspx -> asmx service but I wouldn't recommend it.
Used RESTful WCF as a web service see this: WCF REST Service JSON Post data
and this: http://www.codeproject.com/KB/WCF/RestServiceAPI.aspx?q=wcf+rest+web+service+example
Also used JSON instead of XML tutorial here: http://www.raywenderlich.com/5492/working-with-json-in-ios-5
Also used NSURLConnection but haven't found one very good tutorial yet.

Categories

Resources