Saturday, 17 June 2023

Get Rest API | Core PHP

This post will help you to make get API to return records using core PHP  in JSON format.

Return A single record

<?php

header("Content-Type:application/json");

$response['roll'] = 101;
$response['name'] = "ram";
$response['city'] = "vns";
$json_response = json_encode($response);
echo $json_response;

?>

Next Example

Read (Consume) Rest API using VB.NET Windows Programming

 This post will help you to read a single record from API in JSON format using VB.Net Windows form Application.

Data formate 

{"roll":101,"name":"ram","city":"vns"}
Package Install
NuGet\Install-Package Newtonsoft.Json -Version 13.0.3
Code
Imports System.Net
Imports Newtonsoft.Json.Linq
  Dim json As String = New System.Net.WebClient().DownloadString("your api url")
  Dim parsejson As JObject = JObject.Parse(json)
  Label1.Text = "Roll=" & parsejson.SelectToken("roll").ToString  & ", Name=" &        parsejson.SelectToken("name").ToString  & ", City=" &   parsejson.SelectToken("city").ToString        

   Next Example

VB.Net API tutorial

 




Back to Home

Friday, 16 June 2023

Internet of Things and its applications (M4-R5) | NIELIT O Level

 



Get Next Paper