Have a running Yii1 application. How to enhance Yii1 application with Yii2 restfull api instead of rewriting the whole Yii1 application in Yii 2?
You can work with two separate application or with a yii2 and yii1 application integrated . see this doc for details.
Essentially you must install Yii 2 in your existing application and modify the entry script of the application as indicated in the doc ,
Because both Yii 1 and Yii 2 have the Yii class, you should create a customized version to combine them.
Once you have your yii2 application you can call the services you need
here you can find a quick start guide for restful webservices in yii2
Related
We want to build an asp.net core web application. it contains MVC part for returning Views and API to return JSON and have Restful services for our web application.
So can I have MVC and Web API inside the same project? as currently when i want to create a new project inside .NET 6.0 i have to select the either MVC or Web API type :-
So can I have MVC and Web API inside the same project? as currently when i want to create a new project inside .NET 6.0 i have to select the either MVC or Web API type :-
Certainly you can. What all you need is, you should have one solution. Furthermore, within the solution, you ought to create two project. One for MVC application and another for Web API application. Here is the simulation how you can achieve that:
Project Architecture Would be Like:
If you want to run two project together:
Go to your solution and right click on it
Select Property
Choose Multiple Startup Project
I know that Asp.Net MVC and Asp.Net Web API were merged into one code in Asp.net Core and they inherit from Controller base class and can all return implementations of IActionResult. it be a View for MVC or Json for web api.
But when i want to create a Asp.net Core project, it offers two templates (Web Application and Web Api ), according to what i said in above, there is no differences between these controllers, why there is two templates? is there any differences that i don't know about it?
The web application template will create folders and import stuff needed for a web application such as jquery, css etc. Web api template will create folders and import stuff for a web api. Also the controllers created by default will have different implementations, for example, web application will be returning views and the views will be created in the appropriate folder.
So although they derive from the same controllers, each type of project requires different dependencies.
If I were you I would go ahead and create one for each type and see the difference.
If you want to have both web api and web application in the same project, use areas. This way your web and api will have separate controllers, folders and models. Also if you want to separate them in the future, it will be easy to do so.
The difference between 2 templates is-
The WebAPI template starts with a Controller class that will allow you to respond to RESTful requests at the /api/Values endpoint.
The Web Application template will give you an MVC framework enabled project with some Razor views, the bootstrap CSS framework and jQuery library installed.
If you want to create project with both MVC and API controllers then I would suggest to go with ASP.NET Core Web Application template and add require dependencies.
I want To create Anew API To Use It on app i have web site and want to make API for it, where i should create an API in Frontend Or Backend OR create anew module same frontend level ???
and How I can Create A Module in Yii2 ??
In my opinion you should create a separate module for API.
Please follow below link to learn how to create module.
How to create Modules in Yii2
And for RESTful Web Services follow :
RestApi with yii2
I need to integrate MediaWiki in my Yii project.
Is MediaWiki-API URL-based only?
Yii and MW on same server. I want to manipulate with php-commands, not cUrl.
It is possible to call the API internally, though it requires some understanding of MediaWiki's inner workings. I suggest you start reading at API:Calling internally
In the same solution, I have an MVC 4 Web Application project ("the site") and an MVC 4 Web API project ("the service").
In future, I may want to deploy the service on separate server from the site.
Therefore, I would like the site's model class to call the into the service's web methods.
Is this possible ? How can I accomplish this ?
Unless I'm missing something, why don't you just create the site's model as a separate project in your solution. Your site would reference it. The model would make calls to your web API over HttpWebRequest or something similar.