Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to use curl in asp.net c#

string url = "https://YOUR_COMPANY_HERE.beebole-apps.com/api";
string data = "{"service":"absence.list", "company_id":3}";

WebRequest myReq = WebRequest.Create(url);
myReq.Method = "POST";
myReq.ContentLength = data.Length;
myReq.ContentType = "application/json; charset=UTF-8";

string usernamePassword = "YOUR API TOKEN HERE" + ":" + "x";

UTF8Encoding enc = new UTF8Encoding();

myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(enc.GetBytes(usernamePassword)));


using (Stream ds = myReq.GetRequestStream())
{
ds.Write(enc.GetBytes(data), 0, data.Length); 
}


WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
string content = reader.ReadToEnd();
Response.Write(content);
Comment

PREVIOUS NEXT
Code Example
Csharp :: on trigger unity 
Csharp :: c# best way to loop and remove 
Csharp :: get domain name from email in asp.net c# 
Csharp :: c# list item not in another list 
Csharp :: c# show list in richtextbox 
Csharp :: set text in unity invisible 
Csharp :: c# how to compare 2 dates without time 
Csharp :: how to turn components on and off in unity through code 
Csharp :: unity scroll rect to bottom 
Csharp :: window height in C# forms 
Csharp :: c# return tuple 
Csharp :: microsoft forms create bitmap 
Csharp :: and operator in c# 
Csharp :: how to convert timestamp to datetime c# 
Csharp :: unity ui button 
Csharp :: c# add strings 
Csharp :: how to decrease velocity of a Unity rigidbody 
Csharp :: edit list element linq c# 
Csharp :: select range in list c# 
Csharp :: check if two timespans intersect c# 
Csharp :: global exception handler c# 
Csharp :: c#l list<string initialize 
Csharp :: allow scroll with wheel mouse datagridview c# 
Csharp :: what is float in c# 
Csharp :: redis cache repository .net 
Csharp :: spiral matrix 
Csharp :: change skybox color unity 
Csharp :: minimum of three numbers 
Csharp :: c# while true loop 
Csharp :: 405 - HTTP verb used to access this page is not allowed 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =