Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Sunday 8 December 2019

Swagger - REST API documentation tool

Swagger - REST API documentation tool


Question: What is swagger?
It is REST API documentation tool which is used to list the APIs and view the request and response.
In this, we need to add some annotations in your functions and then it will automatically generate a beautiful and user-friendly documentation for your APIs.



Question: Where it is used?
Whenever we develop an android, IOS (Apple) application, we need to create an APIs for them.

To check the API details (URL, Request, response), we use Swagger.


Question: Who is using swagger?
Backend Developer: developer used it while creating Or updating an API.
Team Leader: As it give List of APIs with request and response. Team leader used it review the APIs.
Android/IOS Developer: While integrating the APIs, Its quite help the developer because they can check the response of APIs with different request.


Question: What are benefits of swagger?
  1. Its give list of APIs with short description.
  2. Its give the Request and Response of API.
  3. We can test the response of API with different request.
  4. We need to integrate in application first time, after the we need to add some annotations in functions/APIs.
  5. Can be integrate in Core PHP or Framework.
  6. We need not to list and details of apis manually.



Question: What is Swagger Editor?
The Swagger Editor is the tool for quickly getting started with the Swagger Specification.
Create new APIs OR update existing ones in a powerful Editor which visually renders your Swagger definition and provides real time error-feedback.
http://editor.swagger.io/#/


Question: Give a Demo URL?
http://petstore.swagger.io/


Question: From where i can download?
http://swagger.io/docs/#swagger-ui-documentation-29


Question: How to Add API in swagger?
Add Following code before the class declaration
/**
 * @SWG\Resource(
 *     apiVersion="1.0",
 *     swaggerVersion="1.2",
 *     description="Search users"
 * )
 */



Question: How to add new Operation for an API?
Add Following code before the method declaration
    /**
     * @SWG\Api(
     *     path="/search",
     *     @SWG\Operation(
     *         method="POST",
     *         summary="Get users near your location",
     *         type="Users list",
     *         @SWG\Parameters(
     *             @SWG\Parameter(
     *                 name="interests",
     *                 paramType="form",
     *                 description="comma seperated looking for",
     *                 required=false,
     *                 type="string",
     *                 minimum="1.0"
     *             ),
     *             @SWG\Parameter(
     *                 name="page",
     *                 paramType="form",
     *                 description="page number",
     *                 required=true,
     *                 type="string",
     *                 minimum="1.0"
     *             ),
     *         ),
     *         @SWG\ResponseMessage(code=400, message="Invalid Data")
     *     )
     * )
     */



Saturday 22 June 2019

How to create an RSS feed from URLs

How to create an RSS feed from URLs

Question: What is full form of RSS?
Rich Site Summary
Its also known as Really Simple Syndication.


Question: What is RSS feed?
It is standard web feed formats to publish the updated information of blog OR website.


Question: What is file extension of RSS Feed?
.xml or .rss


Question: Give a Sample of RSS Feeds?
Start the XML with following code.

<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0">
    <channel>
 <title>Web Technology experts Notes</title>
  <link></link>http://web-technology-experts-notes.in
  <description>We are Web Technology Experts Team who provide you Important information on Web Development</description>
        <item><title>How to create folder with extension like .EBextensions</title> <description>Suppose you want to create folder with name ".EBextensions" Create folder with name ".EBextensions." Press enter You will see "." will disapper automatically from end of string Folder with name ".EBextensions" created successfully.</description><link></link>http://www.web-technology-experts-notes.in/2016/12/how-to-create-folder-with-extension-like-ebextensions.html<pubdate>Tue, 21 Jun 2016 15:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxGQGHkE2lgyXWpEN-LW9mN1MrHB2ldKSvZX-Xn2ZlAh2Zqv33Saw1_sjYdq7i0N4XPzQ6ufeh8JXw6h2ER9sFqLYyXWMUNcJU7suHXO3bgb7EwMdCaRj7yn-hMVfw5VncU7H3gkryBQ1/s72-c/How+to+create+folder+with+extension.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>FCM push notification example</title> <description>Question: What is FCM Messages? Full form of FCM is Firebase Cloud Messaging. FCM is a cross-platform messaging solution that lets you reliably deliver messages to android and IOS devices at no cost. </description><link></link>http://www.web-technology-experts-notes.in/2016/12/fcm-push-notification-example.html<pubdate>Tue, 21 Jun 2016 20:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjl1lCoOWux0EG3hYYW1-rJqB-3iJsLaqIK-zOTjD_2Z_sq9v29LsVY9iC3lfu-6LZLD2TNQOahaajIsOP2y-HSQRGhUoe18L5LnJBHTU0ekF_6nVQMwSrYrkaeAJHYhFFkcds6FHEb6m/s72-c/FCM+push+notification+example.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>What are special characters? and how to remove special characters?</title> <description>Question: What are special characters? Special characters are selected punctuation characters present on standard US keyboard. Question: Provide list of special characters?</description><link></link>http://www.web-technology-experts-notes.in/2016/12/what-are-special-characters-and-how-to-remove-special-characters.html<pubdate>Wed, 22 Jun 2016 01:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjl1lCoOWux0EG3hYYW1-rJqB-3iJsLaqIK-zOTjD_2Z_sq9v29LsVY9iC3lfu-6LZLD2TNQOahaajIsOP2y-HSQRGhUoe18L5LnJBHTU0ekF_6nVQMwSrYrkaeAJHYhFFkcds6FHEb6m/s72-c/FCM+push+notification+example.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>Node JS tutorial for beginner</title> <description>Question: What is NodeJS Node.js is a platform built for fast and scalable network applications. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.</description><link></link>http://www.example.com/url4http://www.web-technology-experts-notes.in/2016/12/node-js-tutorial-for-beginner.html<pubdate>Wed, 22 Jun 2016 06:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7anpECNis2R4U7MyWdWUbi9ygJyKA211ydgESbcWUPGgG3acZwMO4vAKe5MxE53DkFdTOMVPVe8AH76piiHPtCo2YmgVrbI4cabzc7lX1slYKhMOHNDi1oWtvTI4B6bz6qsXQVh-sJL-f/s72-c/What+are+special+characters+and+how+to+remove+special+characters.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
    </channel>
</rss>
Question: Create a script for?
Question: From where I can validate the RSS Feed URL?
https://validator.w3.org/feed/


Question: From where I can validate the RSS Feed Data?
https://validator.w3.org/feed/#validate_by_input


Question: Give a script to generate rss feeds from URL?


$urls= array(
    'http://www.web-technology-experts-notes.in/2016/12/how-to-create-folder-with-extension-like-ebextensions.html',
    'http://www.web-technology-experts-notes.in/2016/12/fcm-push-notification-example.html',
    'http://www.web-technology-experts-notes.in/2016/12/what-are-special-characters-and-how-to-remove-special-characters.html',
    'http://www.web-technology-experts-notes.in/2016/12/node-js-tutorial-for-beginner.html',
    );

$dateTime=strtotime('Tue, 21 Jun 2016 10:36:00 +0000');
$siteMapXml = '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0"><channel>';

//Uncomment the below code to enable download
/*header("Content-type: application/xml");
header("Content-Disposition: attachment; filename=rss.xml");
header("Pragma: no-cache");
header("Expires: 0");*/
$siteMapXml.=' <title>Web Technology experts Notes</title>
  <link></link>http://web-technology-experts-notes.in
  <description>We are Web Technology Experts Team who provide you Important information on Web Development</description>';
foreach($urls as $url){    
    $dateTime+=(3600*5);
    $dateString=date('D, j M Y H:i:s +0000',$dateTime);
     $siteMapXml.="<item><title>Page Title</title> <description>Page Description</description><link></link>{$url}<pubdate>{$dateString}</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxGQGHkE2lgyXWpEN-LW9mN1MrHB2ldKSvZX-Xn2ZlAh2Zqv33Saw1_sjYdq7i0N4XPzQ6ufeh8JXw6h2ER9sFqLYyXWMUNcJU7suHXO3bgb7EwMdCaRj7yn-hMVfw5VncU7H3gkryBQ1/s72-c/How+to+create+folder+with+extension.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>";   
}
echo $siteMapXml.='</channel></rss>';


Question: Give the Sample URL of RSS
Download Sample RSS


Tuesday 24 April 2018

Agora.io WebRTC Basic Understanding


Question: What is Agora Recording Overview?
The Agora Recording SDK is an add-on to record and save voice calls, video calls and interactive broadcasts in server.

Support on below and above versions.
Agora Native SDK version 1.7.0
Agora Web SDK version 1.12.0
Support for CentOS x64 version 6.5 or later and Ubuntu x64 version 12.04 or later.


Question: What are benefits of using Agora Recording?
  1. High-quality recordings for Voice and video.
  2. Single OR Mix audio/video
  3. Raw data of Audio/Photo
  4. Screen Capture
  5. Customized



Question: What services does Agora CaaS provide?
Video/Audio SDKs: APIs for Real-time Audio and Video Communications with one-to-one and one-two-many.
A voice group can be a maximum of 10, 000 people online at the same time;
a video group supports up to seven people online at the same time.

Agora Cloud: We have deployed around 100 data centers in four continents, including thousands of servers.

Real-time Audio and Video Reports: tell you how many active users are using the call service, call duration, call success rate, ratio of low-quality contacts with cause analysis, and so on. In addition, distribution reports show the geographic distribution of users, of network conditions and users, and of time spent on the network. To help with operational and other business decisions, developers can check data by using daily, weekly, or background reports, anytime and anywhere.


Question: What communication functions can I implement in my application by using Agora CaaS?
1. App-App Communication
2. App-Web Communication
3. Web-Web Communication
4. App-Cellphone/Local PSTN Breakout Communication.


Question: What are the differences between Agora.io and WebRTC?
WebRTC is based on P2P, and Agora.io is based on proprietary cloud services architecture that work with P2P as required.
WebRTC may/may-not work on Mobile but Agora.io will work on mobiles.
Voice quality is better with Agora as compare to WebRTC.
WebRTC does not store the video/audio, but Agora.io save the media and stored on their server.


Question: Does Agora.io use WebRTC?
In Web, Agora use WebRTC but with lot of customization which is not available in Normal Webrtc.
In App, Agora does not use WebRTC.


Question: What is the difference between Agora CaaS and a content-delivery platform (CDN)?
In CDN, latency can be from 1-10 Seconds.
In Agora, Latency can be upto 400ms.


Question: Is Agora.io a video cloud?
No, A video cloud provides video on demand and live service. but Agora.io provide real-time live streaming.



Question: Where Agoro.io can be used?
In Call center(BPO) with recording.
LIVE Streaming Audio with available of audio.
LIVE Streaming Video with available of video.
App-Web Audio/Video communication.
App-App Audio/Video communication.
Web-Web Audio/Video communication.
Send Audio message.
Send Video message.
Can be used Educational area as its cheap in cost.


Question: is encryption available in Agora?
Yes.
Agora.io is a safe platform
When the signal is sent, it is encrypted (call setup).


Question: Can we do custom encryption?
By Default Agora built-in AES-128 encryption. but we can use customized data encryption algorithm.


Question: What are the fees for Agora services?
The first 10,000 minutes of each month are free (Audio and Video combined).
Starting from the 10,001 minute of each month, $0.00099/minute (Audio call).
Starting from the 10,001 minute of each month, $0.00399/minute(Video call).


Question: Is Agora.io HIPAA compliant?
Yes.


Question: How does the Agora.io network handle DDoS attacks?
Yes, an anti-DDoS firewall is present in each cloud data center.


Question: Which platforms does Agora.io support?
Android > 4.0
IOS > 6.0


Question: Which codecs are used by Agora.io?
Agora.io uses its own proprietary audio codec, NOVA, which is simple, low-bit-rate, and highly adaptive.


Question: How many people does Agora.io audio/video support at the same time in a call?
Audio Call: up to 10,000 people at the same time
Video Call: up to 7 people at the same time



Question: Does Agora.io provide echo cancellation?
Yes.
Question: How much bandwidth does the Agora.io SDK require?
With Wifi (4KB to 13KB per second)
With Non-Wifi (4KB to 6KB per second)


Question: Is a call interrupted when switching networks, as from Wi-Fi to 3G/4G?
Yes, Short interruption after switching networks in a call, for example, from Wi-Fi to 3G or 4G, due to the clients's needs to re-establish connection.


Question: What is command for recording the media?
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest1 



Question: What is command for (Recording Auddio/Video combine)?
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest2 --mixedVideoAudio 1 --isMixingEnabled 1
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest3 --mixedVideoAudio 1 --isMixingEnabled 1
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest7 --mixedVideoAudio 1 --isMixingEnabled 1



Question: Command to set idle time?
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest10 --mixedVideoAudio 1 --isMixingEnabled 1 --idle 4



Question: Command to set the root directory?
/usr/bin/recorder_local --appId APPID --appliteDir "/opt/Agora_Recording_SDK_for_Linux_FULL/bin" --channel aruntest10 --mixedVideoAudio 1 --isMixingEnabled 1 --idle 4 --recordFileRootDir /var/www/html/recording_files/



Question: What is offical Website of agora.io?
Main Website: https://www.agora.io/
SDK: https://www.agora.io/en/sdk/
Downloads: https://www.agora.io/en/download/
Price: https://www.agora.io/en/price/



Tuesday 17 April 2018

Rev: Online audio transcription, video captions and document translation services

Rev: Online audio transcription, video captions and document translation services

Question: What does Rev provide?
Rev provide the Online audio transcription, video captions and document translation services.


Question: What type of transcription they provide?
They provide transcription like immigration, business, legal, academic and personal needs.


Question: How much they charge?
Rev charges $1 per minute of audio. For example, a 30 minute clip costs $30.00. Timestamps and verbatim are options that cost $0.25 per minute each.


Question: How long will it take?
Audio files under 30 minutes long with good quality audio are typically delivered within 12 hours.


Question: Do they provide timestamps?
Yes, $0.25 per minute.


Question: What type of file format they accept?
We accept audio and video recordings in MP3, MP4, WMV, AIF, M4A, MOV, AVI, VOB, AMR, WMA, OGG, AAC, and WAV.


Question: What is endpoint for sandbox API?
https://api-sandbox.rev.com


Question: What is endpoint for Rev API?
https://www.rev.com


Question: What is documentation URL of API?
https://www.rev.com/api


Question: How to send order online for audio/video transcription?
Step 1
  1. Upload a source file to be used in an order via i.e. /api/v1/inputs
  2. Curl Example
curl -X POST
  https://api-sandbox.rev.com/api/v1/inputs
  -H 'authorization: AUTHORIZATION_STRING_HERE'
  -H 'cache-control: no-cache'
  -H 'content-type: application/json'
  -H 'postman-token: d6eee4bb-84ef-d54b-d15d-9ac9b3230fc2'
  -d '{
    "url": "https://useastpacificgeorama.blob.core.windows.net/useastpacifiddc/GM-qE2zq-1078-5525_720p.mp4"
}'


Response Headers
Location – URI identifying the newly uploaded media. This URI can be used to identify this media when submitting an order.


Step 2
  1. Now order online i.e. /api/v1/orders
  2. Curl Example
curl -X POST
  https://api-sandbox.rev.com/api/v1/orders
  -H 'authorization: AUTHORIZATION_STRING_HERE'
  -H 'cache-control: no-cache'
  -H 'content-type: application/json'
  -H 'postman-token: 10fa5ba8-3739-c3f2-ace9-b115f3bb6f96'
  -d '{
    "client_ref": "Georama-OvanTest",
    "transcription_options": {
        "inputs": [
            {
                "audio_length_seconds": 194,
                "uri": "urn:rev:inputmedia:U3VwbG9hZHMvMjAxOC0wNC0xMy8wMzQzOTY1MC0yMDVhLTQwMDYtYWZmMC01MjI0ZTdkNTQ2MTUvR00tcUUyenEtMTA3OC01NTI1XzcyMHAubXA0"
            }
        ],
        "verbatim": true,
        "timestamps": true
    },
    "notification": {
        "url": "http://example.com/callback/url",
        "level": "Detailed"
    }
}'

Response Headers
Location – URI identifying the newly created order. This URI can be used to request details (such as status) of the order. Only present if a 201 response code is returned.



Question: How rev will communicate to us once order is completed?
Once rev, received the request.
When they just start they will notify to us through callback function.
When they just complete they will notify to us through callback function.
All data will be sent in POST method, and have following parameters.
(
    [order_number] => TD0648810924
    [client_ref] => arunkumartest
    [status] => Complete
)



Question: How to GET order details online?
We can get the order details with API using orderId.
For Example.
curl -X GET
  https://api-sandbox.rev.com/api/v1/orders/TD0648810924
  -H 'accept: application/json'
  -H 'authorization: AUTHORIZATION_STRING_HERE'
  -H 'cache-control: no-cache'
  -H 'postman-token: aad7ead8-0b44-19b1-0f19-2b5baa4a2e6a'
Response Body
 
{
    "order_number": "TD0648810924",
    "client_ref": "OvanTest",
    "price": 4.86,
    "status": "Complete",
    "priority": "Normal",
    "non_standard_tat_guarantee": false,
    "transcription": {
        "verbatim": true,
        "timestamps": true,
        "total_length": 3,
        "total_length_seconds": 194
    },
    "comments": [
        {
            "by": "Georama I.",
            "timestamp": "2018-04-13T11:57:14.97Z"
        },
        {
            "timestamp": "2018-04-13T12:02:46.997Z",
            "text": "Order delivered"
        }
    ],
    "attachments": [
        {
            "kind": "media",
            "name": "GM-qE2zq-1078-5525_720p.mp4",
            "id": "5HYQOsWDAwAAAAAA",
            "audio_length_seconds": 194,
            "links": [
                {
                    "rel": "content",
                    "href": "https://api-sandbox.rev.com/api/v1/attachments/5HYQO2s2WDAwAAAAAA/content"
                }
            ]
        },
        {
            "kind": "transcript",
            "name": "sample_transcription.docx",
            "id": "5HYQOsqDAwAAAAAA",
            "links": [
                {
                    "rel": "content",
                    "href": "https://api-sandbox.rev.com/api/v1/attachments/5HYQO2sqDA2wAAAAAA/content",
                    "content-type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                }
            ]
        }
    ]
}



Question: How to get transcriptions?
curl -X GET
  https://api-sandbox.rev.com/api/v1/attachments/5HYQO2s2WDAwAAAAAA/content
  -H 'accept: application/rev-transcription'
  -H 'authorization: AUTHORIZATION_STRING_HERE'
  -H 'cache-control: no-cache'
  -H 'postman-token: 4376e40d-9e6e-1e5a-e937-6337b9e1ade2'

Response
{"speakers":[{"id":1,"name":"Adam","icon":null,"color":null,"colorCoordinates":null,"note":null},{"id":2,"name":"Mike","icon":null,"color":null,"colorCoordinates":null,"note":null}],"monologues":[{"id":1,"speaker":1,"spans":[{"type":0,"value":"This is a sample first line"}],"startTime":null},{"id":2,"speaker":2,"spans":[{"type":0,"value":"This is a sample second line"}],"startTime":null}],"segments":[],"versionNumber":0,"offsetSeconds":0,"id":50,"name":"test.txt","metadata":{}}


Friday 15 September 2017

Web sockets online Tutorial - Page2

Web sockets online Tutorial - Page2

Question: Difference between socket and websocket?
WebSockets run from browsers and connecting to Server over a similar to HTTP. it require a permanent connection to its server.
Sockets are more powerful and generic and not restricted to http protocol OR browser.



Question: How to detect the message type in onmessage event?
  
socket.onmessage = function(event){
   if(typeOf event.data === String ) {
      console.log("Received data string");
   }
}



Question: How does Web Socket support Single TCP Connection?
In Web a new TCP connection is initiated for a each HTTP request and terminated after the response is received which means A new TCP connection need for each HTTP request. Whereas In WebSocket, the HTTP connection is upgraded and client and server communicate over that same TCP connection.


Question: How Web Socket support on Bi-directional?
In Web client(like browser) only can send the request to server then server send the response to the same client only.
Whereas In WebSocket, there is no pattern like request/response and Both (Client/Server) can send message to other party.


Question: How Web Socket support on Full Duplex?
In Web client(like browser) only can send the request to server then server send the response to the same client only. At a given time, either client is talking to server or server is talking to client. Whereas In WebSocket they can talk each other.


Question: What is the WebSocket API?
The WebSocket API is the asynchronous communication from client to server and it takes place over single TCP socket using the ws (unsecure) or wss (secure) protocol and can be used by any client or server application.


Question: How can we secure WebSocket API?
Normal Web Socket API start with ws but secure API start with wss.

Question: What is Ajax Long-Polling?
  1. A client requests a webpage using HTTP.
  2. The server does not immediately respond with the requested information but waits until there's new information available.
  3. When there's new information available, the server responds with the new information.
  4. The client receives the new information and immediately sends another request to the server, re-starting the process.



Question: What is Comet in HTML5?
Comet is a collection of techniques prior to HTML5 which use streaming and long-polling to achieve real time applications.


Question: What is Server Sent Events?
Server Sent Events (SSE) connections can only push data to the browser.
online stock quotes, or twitters updating timeline or feed are good examples of an application that could benefit from SSE.


Question: How to add http headers in Websockets client API?
We can not add custom header in Web sockets.


Question: How can we pass auth while calling Connecting WebSocket?
 var ws = new WebSocket("ws://username:password@example.com/path");



Question: Is PHP support for Web Sockets available?
Yes, for this you need install the library.
Apache Module: https://github.com/disconnect/apache-websocket
PHP WebSocket: http://code.google.com/p/phpwebsocket/
Ratchet: https://github.com/cboden/Ratchet
Wrench: https://github.com/varspool/Wrench