Posts

Showing posts with the label api's

How to write api method to Read file and save it in ftp server using webapi c#

[Route("getdata")]         [HttpPost]         public string ReadFromAzureAS(string path)         {             //FTP Server URL.             string ftp = "ftp://localhost:21/";             //FTP Folder name. Leave blank if you want to upload to root folder.             string ftpFolder = "Uploads/";             string status = "File Transfer Failed";             FileStream stream = File.OpenRead(path);             byte[] fileBytes = new byte[stream.Length];             stream.Read(fileBytes, 0, fileBytes.Length);             stream.Close();             //Begins the process of writing the byte array back to a file      ...

Read any file using filepath and save it in a folder in c#

// Read file to byte array FileStream stream = File.OpenRead( @" c:\path\to\your\file\here.txt" ); byte [] fileBytes= new byte [stream.Length]; stream.Read(fileBytes, 0 , fileBytes.Length); stream.Close(); // Begins the process of writing the byte array back to a file using (Stream file = File.OpenWrite( @" c:\path\to\your\file\here.txt" )) { file.Write(fileBytes, 0 , fileBytes.Length); }

How to use youtube api's in your application.

Image
First of all, go to the google developer console site and add your google account. URL:  https://console.developers.google.com/ Then the screen shows up, Now, click on select a project on the navbar. Then the screen shows up, Now enter your project name and organization etc, then click on enter. Then it will ask for 2 types of access,  1.OAuth 2.0,  2.API Key   you can use OAuth 2.0 if you want. Here i have selected API Key to get access Then the screen shows up, Now, you have the API Key to get access to google api's. Note: Copy and paste the API Key in a notepad for further use. Now go to the youtube for the developers site. Url:  https://developers.google.com/youtube Then below screen shows up, Here, click on samples from nav bar and select the language you are using and again select references from the navbar. Then the below screen shows up. Now, Here i want to show th...