curl for Twilio with out helper library
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/[sid]/Messages.xml' \
--data-urlencode 'To=+919400xxxxxx' \
--data-urlencode 'From=+1484925xxxx' \
--data-urlencode 'Body=[body]' \
-u [sid]:[AuthToken]
I wanted to Do it using C# code. ( I don't have much knowledge in C# )
I just checked these
Making a cURL call in C#
cURL with user authentication in C#
But gives invalid request.
You can start by using Nuget to download the Twilio helpers, search for Twilio.
Once you have that package installed, you can use it like this.
var client = new TwilioRestClient("accountsid", "authtoken");
var result = client.SendSmsMessage("from", "to", "body");
Related
I know it's unorthodox, but I'm trying (C# - .NET Framework 4.8) to send a multipart form-data request with GET verb.
I need to send a file and some parameters, but the end-point receiving the call blocks POST/PUT requests without a valid (for them) JSON body, and I have no control over it.
I managed to do that with Postman, and this is the curl command:
curl --location --request GET 'https://myrestapi.com' \
--header 'MyPersonalHeader: mydata' \
--header 'Content-Type: application/json' \
--form '=#"/C:/mypath/myfile.zip"' \
--form 'MyParameter1="myvalue1"' \
--form 'MyParameter2="myvalue2"' \
The end-point accepts this call.
How can I make it in C#?
Trying to generate a cURL string from an incoming request in my c# web api. Not sure how to proceed. I could of course take all parts and create it myself but I was wondering if there are some easier ways of doing it?
For example a request:
curl --location --request POST 'http://localhost:54521/v2/Token'
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=usr' \
--data-urlencode 'password=password' \
--data-urlencode 'grant_type=password'
Then generating it again on my API - as a string, that I could use with cURL. Suggestions?
I am trying to connect to clarify photo tagging service using c#. unfortunately they do not have a client api and I need to send cURL requests
The company website display the following code
curl "https://api.clarifai.com/v1/tag/" \
-X POST -F "encoded_data=#/Users/USER/my_image.jpeg" \
-H "Authorization: Bearer {access_token}"
I have tried different options with no luck
Is there a simple wrapper that I can use (that support the –x and –h options)
Or even better a code sample on how to approach this issue
Many thanks in advance
I believe, that Process.Start() suites your needs.
I have got following curl code in documentation
curl \
-F 'name=My First Campaign' \
-F 'campaign_group_status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/act_<AD_ACCOUNT_ID>/adcampaign_groups
I don't know how can i create Campaign from here, I have got <AD_ACCOUNT_ID> and access token also. Please guide me.
I need to send a request of this type:
curl \
-H 'Authorization: OAuth AJOBibdmecfKxOpEeRWbdmVVCGujGRU3JKA0jyQM' \
-F 'lecture\[media\]=#video.avi;type=video/mpeg' \
-F 'lecture\[name\]=My lecture' \
-F 'lecture\[type\]=Media' \
http://www.redu.com.br/api/subjects/117/lectures -vv
I want to use the WebClient class in C# to make a multipart POST request for sending JSON + file to be loaded, but do not know how I can do this, can anyone help me?