Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
i! I got a problem make the curl command equivalent to my C#
Mario SAg
8y
314
1
Reply
$ curl
-X POST
-H
"Authorization: Bearer YOUR_ACCESS_TOKEN"
-F
"recipients[0][name]=John"
-F
"recipients[0][email]
[email protected]
"
-F
"files[0]=@/path/to/the/pdf/document.pdf"
https:
//api.sandbox.signaturit.com/v3/signatures.json
i made this code in c#
using
System;
using
System.IO;
using
System.Net;
using
System.Text;
using
System.Web;
public
class
Program
{
public
static
void
Main()
{
string response = SendSignatureRequest(
"ZDM4NzU1YTVmNmFhNGMwMGQ3MTdiOTBhNmNiZDQzOTlkYjg4OTk0MTg5MGM3OGFlZjk1OWM1ZDg1NTQxYzBjYQ"
,
"Mario"
,
"
[email protected]
"
,
//"http://www.analysis.im/uploads/seminar/pdf-sample.pdf"
"@c://Mariete.pdf"
);
Console.WriteLine(response);
}
public
static
string SendSignatureRequest(string apiKey, string name, string email, string file)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
"https://api.sandbox.signaturit.com/v3/signatures.json"
);
request.Method =
"POST"
;
string authorization = apiKey;
request.Headers.Add(
"Authorization"
,
"Bearer "
+ authorization);
var postData =
"recipients[0][name]="
+ name;
postData +=
"&recipients[0][email]="
+ email;
postData +=
"&files[0]="
+ file;
var data = Encoding.ASCII.GetBytes(postData);
request.ContentType =
"application/json"
;
request.ContentLength = data.Length;
using
(var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return
new
StreamReader(response.GetResponseStream()).ReadToEnd();
}
}
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Regarding Whatsapp API registration
how to get datetime with nanoseconds in c# asp.net