How to create manual pagination with search filter in Laravel API?

When you are using To Laravel Project with Connect to Api. Then pagination and search filter (laravel default) will not work in this process. So, you can use DataTable or Manual. So in this blog I am using manual.

This is a Search Input filter

This is Pagination

This is Js in script tag

This is First Laravel Project Controller Function for sending requests for pagination and Search Filter.

This is Second Project Controller Function for pagination and search filter.

Tagged : / / / / /

How to use JQuery AJAX Method to Call an API?

In this blog in am going to explain that How to use JQuery AJAX Method to Call an API for to load data from external website or external File of etc, by calling APIs, and get the response in JSON or XML formats. So first thing I am going to create a html file and import jquery cdn. If you want to bootstrap css, & js cdn the you can copy from this link Click Here as below-

In this code I am using bootstrap cdn with jQuery cdn after that a Script tag in this script tag ajax function call with json data for getting data showing in cosole.log. If you using first time jQuery then you can right button of mouse and select inspect (Ctrl+shift+i) after that showing below tab then select console tab. When you click Here button from document then showing all data which retrieve.

Tagged : / / / /

HOW TO CREATE API IN LARAVEL

1st step:- open command prompt and go to xampp\htdocs folder and write the code given below in command prompt to create the project

Composer create-project –prefer-dist laravel/laravel admin “5.5.*”

2nd step:-now go to the project folder and make auth. Code is given below

               php artisan make:auth

3rd step:- Now install the passport. Write the code given below in command prompt.

    Composer required laravel/passport

4th step:-open phpmyadmin and make a database.

5th step:- open .env file and configure the database.

6th step:- Now migrate the database. Write the code given below in the command prompt

     php artisan migrate

7th step:-Add the code given below in user model.

       use Laravel\Passport\HasApiTokens;

8th step:- Add the code given below in auth service proviser(C:\xampp\htdocs\ admin\Providers\AuthorServiceProvider.php)

      use Laravel\Passport\Passport;

9th step:- Now configure auth.php(C:\xampp\htdocs\admin\config\auth.php)

Change the driver and provider as given below in api:-

‘api’=>[

‘driver’=>’passport’,

‘provider’=>’users’

],

10th step:- Add the code given below in kernel.php. (C:\xampp\htdocs\ admin\app\Http\Kernal.php)

Protected $routeMiddleware=[

‘client’_credentials’=>\Laravel\Passport\Http\Middleware\CheckClientcredentials::class,

11th step:-Add the code given below in app.php(config\app.php)

/*

   *Application Service Providers…

  */

 //Passport Service provider

    Laravel\Passport\PassportServiceprovider::class,

];

12th step:- Write the code given below in command prompt.

              php artisan passport:install

      Encryption keys generated successfully.

Tagged : / /

Jenkins Remote access API Example | Jenkins Tutorial

jenkins-remote-access-api-example
Jenkins Remote access API Example
Jenkins provides machine-consumable remote access API to its functionalities. Currently it comes in three flavors:
XML
JSON with JSONP support
Python
Remote access API is offered in a REST-like style. That is, there is no single entry point for all features, and instead they are available under the “…/api/” URL where “…” portion is the data that it acts on.
For example, if your Jenkins installation sits at http://ci.jruby.org/, visiting http://ci.jruby.org/api/ will show just the top-level API features available – primarily a listing of the configured jobs for this Jenkins instance.
Or if you want to access information about a particular build, e.g. http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/, then go to http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/api/ and you’ll see the list of functionalities for that build.
Remote API can be used to do things like these:
Retrieve information from Jenkins for programmatic consumption.
trigger a new build
create/copy jobs
Jobs with parameters, Also see Parameterized Build.
Simple example – sending “String Parameters”:
curl -X POST JENKINS_URL/job/JOB_NAME/build \
  –data token=TOKEN \
  –data-urlencode json='{“parameter”: [{“name”:”id”, “value”:”123″}, {“name”:”verbosity”, “value”:”high”}]}’
Check Jenkins Job Status via REST API
job_status=`curl https://jenkins/view/job/other-job/lastBuild/api/json | grep “\”result\”:\”SUCCESS\””`
if [ -n "$job_status" ] then     # Run your script commands here else   echo "BUILD FAILURE: Other build is unsuccessful or status could not be obtained."   exit 1 fi
How to restart Jenkins manually?
To restart Jenkins manually, you can use either of the following commands:
(jenkins_url)/safeRestart – Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/restart – Forces a restart without waiting for builds to complete.
Reference
Tagged : / / / / / / /