In the previous version (4.x), we were able to initilize a TwilioRestClient instance per request. In that way, we could generate clients to use for accounts and subaccounts.
Is it possible to do the same with the newest version (5.x)?
Twilio Dev Evangelist here.
With the new version of the SDK for C#, there is no need to instantiate the RestClient more than once. You would initialize it by making a call to a static TwilioClient.Init method, passing in your account SID and auth token.
You can alternatively create your own REST client that derives from ITwilioRestClient, but that would totally depend on your use case.
Check out our migration docs here. It provides details on this and other changes for migration scenarios.
Related
I'm not sure if anyone will be able to help me or not but I am hoping there is someone familiar with the .NET SDK for MYOB.
The service classes accessible in the SDK provide the core HTTP
operations available for each consumable endpoint. These include the
following operators:
Get/GetRange – HTTP GET Insert – HTTP POST Update – HTTP PUT Delete –
HTTP DELETE
https://developer.myob.com/api/myob-business-api/arlive-sdk/dotnet_sdk/sdk-services/
The InvoiceService is accessed via
MYOB.AccountRight.SDK.Services.Sale.InvoiceService.
I have instantiated an InvoiceService object:
var invService = new InvoiceService(configuration);
However the InvoiceService class does not have an "Insert" function.
The API endpoint documentation suggests a "POST" is possible though: https://developer.myob.com/api/myob-business-api/v2/sale/invoice/invoice_service/
Am I using the wrong class? I unfortunately can't find any SDK documentation.
Try to use MYOB.AccountRight.SDK.Services.Sale.ItemInvoiceService instead of MYOB.AccountRight.SDK.Services.Sale.InvoiceService.
I tried to get the content of the user's profile picture and I found out that I had to call the Beta version because the current version gives the following error message:
"code": "GetUserPhoto",
"message": "The operation is not supported."
So, I tried to switch to Beta, and here is the code that I wrote in C# to do it, but it doesn't work:
Microsoft.Graph 1.6.2
List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$api-version", "beta")
};
var pictureStream = await graphClient.Me.Photo.Content.Request(options).GetAsync();
I got the same error message.
I tried the same request in the Graph Explorer. The 1.0 doesn't work, but Beta works.
The api-version query parameter is used by the Azure AD Graph API. This is a different API than Microsoft Graph. There is a lot of functional overlap (Azure AD Graph is slowly being migrated over to Microsoft Graph) but they use entirely different entities and calling conventions.
In order to call the /beta endpoint using the Microsoft Graph .NET Client Library, you need to change the BaseUrl of the client:
graphClient.BaseUrl = "https://graph.microsoft.com/beta";
var pictureStream = await graphClient.Me.Photo.Content.Request().GetAsync();
Some important notes about the /beta endpoint:
It isn't supported and isn't suitable for production. So don't do that. Or at least don't tell anyone and don't call Support if it stops working. ;-)
The .NET Client uses objects constructed off the production metadata. This means that any entities, actions or properties that were added in /beta don't exist in the models shipped with the SDK.
The .NET Client will ignore any values returned by Microsoft Graph that it doesn't expect to see. So if an endpoint returns a property that wasn't included in the production metadata (see #2), it will simply be ignored.
So long as you're only using a /beta to gain functionality but still expecting /v1.0 results, it should work okay. Photos for example only look at Exchange in v1.0 but look in both Exchange and Active Directory but still return the same result. In theory this means you should be able to swap /beta for /v1.0 without a problem.
I think you are still calling V1 endpoint. In fact, the Beta endpoint is not currently supported in the Microsoft Graph .NET Client Library. More info here.
There is an official beta client for Graph API now:
https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet
How do I update the Base URL that Twilio uses for the SHA-2 update? I don't see any place to do this. We use the Twilio Rest using .Net CSharp code.
Please advise.
Megan from Twilio here.
You can check your setup against this endpoint: api.twilio.com:8443. If a test command to that endpoint succeeds, then you should not be required to make any changes.
If your command fails, I would recommend following the instructions here. An example in C# (be sure to update your Account SID, Auth Token, the From Phone Number and the To Number):
var client = new TwilioRestClient(
"[YOUR_ACCOUNT_SID]",
"[YOUR_AUTH_TOKEN]",
"[YOUR_ACCOUNT_SID]",
"2010-04-01",
"https://api.twilio.com:8443/");
var result = client.SendMessage("[FROM_PHONE_NUMBER]", "[TO_PHONE_NUMBER]", "Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed");
If the above fails:
Outside of syntax errors, most likely your SSL libraries need to be updated. There is an SSL library on your server, and by the way it is not exactly the same thing as a Twilio helper library that you are probably using. You'll need to make sure your SSL library is up to date by December. If you are using a cloud provider, they can help confirm. If you are hosting yourself, your IT should check - if it is OpenSSL, for example, you should see if you can get it up to date.
Hope this helps.
Can you guys show me how to retrieve instanceId, dns public name and type of current EC2 instance from where I'm running the code...
I'm playing with DescribeInstanceAttribute(), but it needs to supply the instanceId to the request, and I can't find how to get the id of currently running instance.
There's a much easier method than making a web API call, the .NET SDK.
See the SDK documentation for EC2InstanceMetadata here
For example, if you need InstanceId you can use:
Amazon.Util.EC2InstanceMetadata.InstanceId.ToString();
All the other properties are available in a similar manner.
Note that the SDK used to have Amazon.EC2.Utils - this was deprecated in 2015 and moved to Amazon.Util namespace
There's a webservice that returns machine information. Access
http://169.254.169.254/latest/meta-data/instance-id
To retrieve the instance id
The Instance Metadata Documentation can be handy.
You can also use AWS's Dot Net SDK for example Amazon.EC2.Util.EC2Metadata.InstanceId.ToString();
As of August 15, Amazon made it compulsory to sign all requests made to their Product Advertising API. I thought I had got everything working just fine but when the 15th finally came around, my web application stopped working and pretty much ever since I have been trying to find out how to sign the SOAP requests.
Amazon has an outdated sample code for signing requests that doesn't appear to work here
Basically, I need to know how to add a signature to the my requests using the most current C# SOAP API and .NET 3.5.
I hope I have given enough details, if I haven't please feel free to ask me to elaborate.
Thank You
The_Lorax
UPDATE:
I am using MVC and need to know how to add the Signature to the the ItemLookup or AWSECommerceService object. Is there an attribute that contains the signature value? How does it get attached to the request?
On this page, they say that I must include the Signature and TimeStamp parameters but the intellisense does now show any such attributes.
Check out http://flyingpies.wordpress.com/2009/08/01/17/. It has a walkthrough and a sample visual studio solution using C#, SOAP, WCF on .NET 3.5.
This library automatic sign the requests (Install-Package Nager.AmazonProductAdvertising)
https://www.nuget.org/packages/Nager.AmazonProductAdvertising/
Example:
var authentication = new AmazonAuthentication("accesskey", "secretkey");
var client = new AmazonProductAdvertisingClient(authentication, AmazonEndpoint.US);
var result = await client.SearchItemsAsync("canon eos");