How do you get the OfferDurableId for an Azure subscription? - c#

In an attempt to call the RateCard API in Azure there is a need for several parameters that the typical Azure administrator will not have at hand easily. These include:
OfferDurableId
Currency
Locale
RegionInfo
If all we have is the subscriptionID, how do we programmatically get the above information so we can get the rate card for the subscription?
While Microsoft samples on GitHub (https://github.com/Azure-Samples/billing-dotnet-ratecard-api) demonstrate this using an app.config the reality is there is a lot of friction asking administrators to dig this up. There has to be a way to get this information without having to ask the admins all the time.
A typical URL to call the rate card API would be something like:
string url = $"https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId=\'{offerId}\' and Currency eq {currency} and Locale eq=\'{locale}\' and RegionInfo eq \'{regionInfo}\'";
Any ideas what APIs I can call to get this information from the subscription ID?

I think that except for the OfferDurableId parameter (which you can see the available values at Microsoft Azure Offer Details), the rest of the parameters should have a fixed value depending on the loction relevant to your organization.
For example, if your organization is located in the United States, then you would probably use:
Currency: USD
Locale: en-US
RegionsInfo: US
Update
Unfortunately, the API reference page states clearly to consult the Offer Details page to get the required ID:
Set {OfferDurableId} to a valid Offer ID code (e.g., MS-AZR-0026P). See Microsoft Azure Offer Details for more information on the list of available Offer IDs, country/region availability, and billing currency. The Offer ID parameter consists of the “MS-AZR-“ prefix, plus the Offer ID number.
Regarding whether it will allow you to query using Currency/Locale/RegionInfo values not used by your subscription, I think it should be possible (to some extent at least), as your a just querying for general metadata.
Hope it helps!

Related

StockTwit User Lookup

I am using the ST Search/User API method and am able to get a response however it is limited. In the documentation found here, if you click on "Extended Version" it shows you can get the followers, following, ideas, and etc. However when I access the API, I only get in return id, type, username, name, avatar. Its very limited compared to the API documentation.
Am I doing something wrong or has the API changed? The query I am using is this https://api.stocktwits.com/api/2/search/users.json?access_token=ACCESSTOKEN&q=USERNAME
Extended data is for partner level access only. Please refer to the getting started guide here https://stocktwits.com/developers/docs/start
If you would like partner level access, please send us an email at api#stocktwits.com

How to get a developer key for ViaGogo API

Long shot, but I'd like to fiddle with ViaGogo API (C# library more precisely). ViaGogo has a well documented public API, documentation is avaliable here.
Problem is, you need to authenticated as it usually happens with this kind of APIs: usually, you find a section of the website, maybe in your profile section, where you can obtain keys, secrets and so on (this happens for example on Facebook or Amazon).
As for ViaGogo, I only found a link that points to a Google Form: this form asks for info about advertising and affiliation on a complete different level of what I need, I won't publish anything read via API. Furthermore, there's no field to leave an e-mail address.
Their C# library seems pretty popular as far as I can tell from downloads from NuGet; I wonder how all these thousands of devs succesfully called that API.
Has anyone succesfully obtained authentication info from ViaGogo?
According to note in registration form, you have to wait for 30 days for their reply.
For more help you can contact them on following contacts:
E-mail: affiliate#viagogo.com
Telephone: +442075532777
Or
http://www.viagogo.com/in/help
There doesn't seem to be any way around this registration according to their website and the api itself -- an appID and password is required. You may try your luck emailing them at Affiliate.Team#viagogo.com -- see this issue on github where the possibility of getting an account via email is discussed: https://github.com/viagogo/developer.viagogo.net/issues/24

Lync - inconsistent behavior with ContactEndpoints

I'm working on custom UI for company's directory based on Lync. Using Lync 2013 I execute this search:
Container.Instance.Lync.ContactManager.BeginSearch(SearchQuery,
SearchProviders.GlobalAddressList,
SearchFields.AllFields,
SearchOptions.IncludeContactsWithoutSipOrTelUri,
500,
ContactsAndGroupsCallback, SearchQuery);
For each of matching contacts I try to access their endpoints to display phone number:
var cit = ContactInformationType.ContactEndpoints;
var endpoints = contact.GetContactInformation(cit) as List<object>;
Problem
If found contact is in the contact list of account I'm using to connect Lync, then I get access to full details (5 endpoints). However if he is not in contact list, I get access to only 1 endpoint.
Any ideas why is it happening like that? Is there a global privacy setting I need to turn off or something?
How can I get access to all endpoints at all times?
Thank you.
PS: I tried to load each contact in the result set individually and still get the same behavior.
I encountered a similar problem when trying to write a program to obtain the status of all users on Lync SDK 2010. Chose all users and read it's status (online / offline etc.). But it's working out well with only those contacts that were in the list of client contacts. I do not know why, but the solutions are not found.A little later I use UCMA 4 (with Application endpoint), though the list received from AD and only able to get the current status.
Maybe it makes sense to use the search by AD? Find phone number by user sip? If so, try to use this filter for DirectorySearcher:
searcher.Filter = "(&(objectClass=user)(msRTCSIP-PrimaryUserAddress=*))"; //put sip instead of *
P.S. what sdk are you using?
Answer from Microsoft Support:
The behavior you are seeing is due to presence subscription optimization to the Lync client so that the subscription is delayed until the necessary contact information is required by the Lync client. Photo is an example for this optimization. Another example is ContactEndpoints. Please take a look at Contact presence subscription changes section of the Migration doc for Lync 2013 page in MSDN docs.
Specifically you must create and maintain your own ContactSubscription for the contacts that you need all the ContactEndpoints.
I have been facing the same issue. You can try loading the person's ContactCard before calling the GetContactInformation function explicitly
Microsoft.Lync.Controls.ContactCard objContactCard = new Microsoft.Lync.Controls.ContactCard();
objContactCard.Source=objContact.GetContactInformation(ContactInformationType.EmailAddresses);
ContactSubscription _contactSubscription = lyncObj.ContactManager.CreateSubscription();
_contactSubscription.AddContact(foundContact);
_contactSubscription.Subscribe(ContactSubscriptionRefreshRate.High, _ContactInformationList);
However, you still might get some delay in getting the information (phone numbers). You can choose to use Thread.Sleep or might just want to retry.
Hope this helps.
Problematic is relying on contact information even for the lync client user. In our solution we are doing something like this:
Contact user = LyncClient.GetClient().Self.Contact;
string email = user.GetContactInformation(ContactInformationType.PrimaryEmailAddress) as string;
I would expect that the current lync user contact always is filled properly. And if it wasn't, I'd expect the code to throw an exception or at least return null or an empty string.
Instead it sometimes returns the sip-uri of the contact without the leading "sip:" prefix. Oddly enough this is not always reproducable: Most of the time the code above returns the primary email address (according to active directory) correctly, sometimes it behaves as mentioned above.

eBay API: How do I specify "Standard Shipping (FedEx Ground or FedEx Home Delivery®)" as a shipping service?

I am wondering how I specify "Standard Shipping (FedEx Ground or FedEx Home Delivery®)" as a shipping service using the eBay API. Can anyone provide any pointers? All of the samples just use the "Standard Shipping" option.
You need to specify FedExHomeDelivery. A table of shipping services for most eBay sites can be found here. Simply use the values in the ID for importing column for your eBay API calls.
As the types of shipping services change over time you may wish to periodically retrieve the latest services via the API as follows.
For each eBay site that you are interested in make a call to GeteBayDetails with a DetailName value of ShippingServiceDetails.
In the results iterate over all the ShippingServiceDetails elements. Each one is a shipping service for the site that you specified.
Important properties for each service that you will need to check are,
ValidForSellingFlow - If this set to 'true' the service can be used in the Add/Revise/Relist API calls otherwise you can not use it.
Description - You can use this value when presenting services to a user. The text should match what users see when listing via eBay.
ShippingService - This is the value that you want to use in your API calls.
You can find all available shipping methods in the documentation of ShippingServiceCodeType.
Beware to use the correct ones of the site id where item will be placed.

Identify if an email address is 'public'

I would like to identify if an email address comes from a public provider or is from an established business. I consider public email addresses to be things such as:
Open email service providers, such as
gmail, hotmail and yahoo.
Anonymization services, such as mailinator or dispostable.
I'm aware that there is no foolproof way to do this, and obviously any list based solution would require constant updates.
Is there a public listing or .NET library that can do this for me?
Are there really that many free webmail providers out there? I would go with a 'blacklisting' style solution.
For example, flag everything in this wikipedia list as free (heck I would think covering gmail/hotmail/yahoo/aol would cover a huge % of users anyway). Then if you get more than 2 (or higher number if your site has high throughput) registrations from the same email domain, it notifies the admin to check the domain to see if it needs to be added to the 'blacklist'.
I would imagine there are much more reliable ways to detect business customers though. For example in Australia you could just ask for an ABN and then check that it's valid. Are you willing to punish small business who don't have email providing and just use a generic #gmail account?
Here is a link to SpamAssasin's freemail list: http://svn.apache.org/repos/asf/spamassassin/trunk/rules/20_freemail_domains.cf.
I suppose, checking against this list is a good start.
You might want to talk to the Better-Business-Bureau ( http://www.bbb.org ) and see if they provide some kind of a feed or API. I had a quick look at their site and couldn't see anything obvious, but it would be this kind of organisation I would head to first if I wanted to find out domain names belonging to established businesses. They do have a form on their site to search by email address ( http://www.bbb.org/us/Find-Business-Reviews/ )
Consider using HubSpot blocked domains list. It is not a guarantee that it is 100% accurate or complete.
They also provide a CSV file that you can download and parse programmatically. Link to CSV file is in the linked page.
I am guessing the ultimate goal is to clean your database from unwanted contacts that will increase the monthly bill. What you can do is the following:
Create a webhook that is triggered whenever a new contact is added.
In that webhook (which can be written in any language), check if the contact is in a blacklist (which is gmail/etc...).
Remove the contact if it is in a blacklist using an API call (you will need to first get the contact ID, which can be easily retrieved using API).

Categories

Resources