I am using the SalesForce Partner API, not the Enterprise API. I want to be able to programatically (C#) add a custom field to any object in SalesForce (as an External ID) so I can merge data from external systems into the SalesForce object. I know there is a way to do this with the MetaData API, but I've also seen a number of references that suggest it's possible through the Partner API, which would be far better because we don't need to spin up yet another API connection to achieve this.
There seems to be no information about this anywhere. I can't find anything on the SalesForce.com help website or anywhere else on the internet and although mentioned in other posts, it doesn't appear that anybody has posted information about how to do it, or not that I can find anyway.
Can anybody point me in the right direction? Some sample code or a link to an article somewhere describing how to do it?
Thanks very much.
Since you need to create a custom field - which is metadata - only Metadata API can help you.
I am not sure what you mean by "to spin up yet another API connection" - but you can use Metadata API in the same service IMHO. Just get the Metadata WSDL and consume it. All your other calls with the partner api remain the same.
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_calls_intro.htm
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_quickstart_java_sample.htm
Related
Could somebody help me find an example of getting data from SalesForce using its api with c#? E.g. getting a Contact information by its email address?
There are ready-built libraries for .NET integration such as https://github.com/wadewegner/Force.com-Toolkit-for-NET, I'd suggest starting with one of these. (old but official). Another one could be https://github.com/anthonyreilly/NetCoreForce
Old, stable, battle-tested or you want to craft the SOAP / REST messages yourself, read up about security tokens, oauth scopes, error handling, bulk API options? I'd offload at least the login part to existing library but your call :) There are many ways to connect, there's even (paid) SQL server plugin or azure data factory solution...
".NET toolkit" seems to use old SOAP API. It's... simple. You provide username, password and you get total impersonation. The app will be able to do everything the connecting user can do. The other one seems to use client id and secret, this sounds like newer REST-based API implementation (OAuth2 keys). This is slightly better, you get extra security layer of the connected app and for example if "scope" is only set to Chatter - even admin's session connecting via this app can't be abused.
There are slight differences between the APIs and the way they handle certain features (for example downloading a Document/Attachment/File via SOAP API will give you base64-encoded payload while REST API will give you a link to download the binary separately). And of course how much of the API does the library actually implement, how well it's maintained...
But generally I'd say explore the libraries first. At least steal some ideas around login logic. If nothing off-the-shelf works for you - consume the WSDL and hand-craft something in SOAP API. Worst case - craft the XML messages manually, worry about escaping special characters etc.
Get an account and api key and then use the official programming interface:
https://developer.salesforce.com/docs/apis
i'd choose: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_resources.htm
So You have to read and understand this: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/using_resources_working_with_searches_and_queries.htm
:)
We have an App in the App store and lately we've been having a lot of errors with the endpoints. We're making a WebClient request (C#) to the App store /verifyReceipt endpoint with receipt-data field. All of the documentation I'm finding is for XCode and C++/Swift.
When I make a post or a Get to https://buy.itunes.apple.com/verifyreceipt I get a 404 from Postman, which should mean the endpoint doesn't exist, but I'm concerned that it's telling me that my receipt doesn't exist (since I'm not passing it valid receipt data, just trying to check the health of the endpoint). When I try the same endpoint in the Sandbox I get a 503 Service Unavailable.
I'm new-ish to this company and incredibly new to dealing with the App Store. The documentation is extensive and seems to give little context for me to easily pick it up without completely rebuilding the API. Could someone direct me to a resource that might help? And yes I've googled, but haven't found anything specifically pertaining to their REST API.
Additionally if you know something about the REST API and if they closed down the service or something could you please direct me to information about that?
As you pointed out it is case sensitive. Correct endpoint is /verifyReceipt. The documentation with all fields is here https://developer.apple.com/documentation/appstorereceipts.
Scope: I am developing a mobile application using Xamarin (C#) to target both Android and iPhone (initially Android). The application logic is separated out in to a PCL (C#) where possible to ensure maximum code reuse. The application integrates with the YouTube Data API v3 for the purpose of rating retrieved videos and allowing subscription to a channel.
Background: As per the documentation (http://developer.android.com/google/play-services/auth.html) I have used the suggested approach to generate an OAuth2 token for the authorised requests from Android, using the AccountManager.getToken method and this works fine and returns a token.
The next step is to make requests using this token (let's take rating a video as an example). My initial idea was to utilise the .NET client library for the YouTube Data Api (https://developers.google.com/api-client-library/dotnet/get_started). However, it seems that this would take us through the whole authorisation process once again and would likely require a web view redirect or similar. I had hoped that there may be a way to use a token which had already been retrieved to create the credential object or create the service from directly, but it doesn't appear to be the case.
The second problem I have found with the client library is that not all of the classes appear to be referenced when adding the NuGet package, namely the GoogleWebAuthorizationBroker. Additionally, as we are in a PCL we are limited with common objects such as FileStream which is utilised in the documented examples (https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth). I did try to use this library from a non-PCL project also to confirm that it wasn't just the limited references in the PCL which were responsible (for the GoogleWebAuthorizationBroker reference issue).
The other option therefore was to look at manual construction of the URL and then posting the data to make the HTTP request ourselves. This too has met with limited success similar to the question listed here: Like video with access token on YouTube using YouTube Data API v3?, which doesn't appear to be answered (suggestion to use the client api). Is this method supported, and if so are there some documented .NET examples? This method would allow me so get the token natively (on android, iphone) and then pass it to a PCL library where I could make the requests, which would be preferable.
Question: So my question is given the scope of what I am trying to achieve here what would be the approved/suggested approach. Clearly the more I can do within the PCL the better from a code reuse point of view, but right now I'd be fairly satisfied with an approach that will actually just work for Android. If anyone has any examples of successfully making authenticated requests to the YouTube Data Api (v3) from Android that would also be useful. I feel like I've trawled through a lot of the documentation to this point over a number of days but not found anything definitive to say "this is how you should do it".
Thanks in advance for any help.
Well, I wouldn't necessarily deem this the answer to my question, however, it is the approach I have taken, so thought I would report back. I have kept the OAuth2 token generation code inside the Xamarin Android project and then pass that on to a PCL which has a repository to deal with the YouTube integration. As there are only a few calls I need to make (ratings, subscriptions and comments) I have elected to manually construct the POSTs via HttpClient and proceed that way.
Perhaps not as elegant as the client library integration but gets the job done. For reference this is made a lot easier if you use the Google OAuth Playground (https://developers.google.com/oauthplayground/) first to get the token and confirm the correct JSON for your request.
If anyone has any problems with this approach then let me know and I can post specific service calls as an example.
From what I can gather, this isn't what google-api-dotnet-client is for.
If you look at the source code (https://github.com/google/google-api-dotnet-client), you can see that GoogleWebAuthorizationBroker is defined for Windows Store, WP 8 etc.
This suggests that the library is intended for .NET clients running on Microsoft operating systems, rather than Android, iOS etc.
These might be the droids you are looking for:
https://github.com/xamarin/GooglePlayServicesComponents (Android)
https://github.com/xamarin/GoogleApisForiOSComponents
They are Xamarin wrappers around the Google SDK for each platform.
This makes sense because of the way Google APIs are called on Android. Rather than rely on a client secret which one should not embed in the application, the you register the app's signature against the "installed app" client ID. The operating system then provides this key when calling google services. You won't get that functionality in a PCL :)
I'm using ServiceStack but am not sure how to approach what must be simple and common concepts. Perhaps this should be posted as two separate questions.
How would I provide the server URL to the client? It's not inherently a ServiceStack problem but would like to know if there's something out of the box which I've missed. I'm thinking either through a config file for a client desktop application or perhaps a web service discovery mechanism, if such a thing exists.
edit: I am referring to the base / root URL of the server, where the clients are desktop applications (in some cases deployed in house). Most ServiceStack examples use a hard coded "localhost:82". So a mechanism to discover the real URL is needed..
To generate a RESTful service I would like to provide links (href's) so that a client could potentially navigate without knowing too much about the service. Is there a simple way to do this? Is it a matter of extending my response DTOs and pushing these details? From a separation of concerns POV it doesn't feel like the best way to do this.
Thanks!
I think that the built in ServiceStack metadata page can help you out on both accounts. It should be available to you automatically at http//:[service_root]/metadata. For example:
http://www.servicestack.net/ServiceStack.Northwind/metadata
You could provide this URL to a customer, and they should be able to interact with the service without issue. It provides detailed information on all service operations, different ways to call them, and even sample request/responses in supported content-types.
You can provide operation descriptions to help clarify even further by decorating your request DTOs with the [Description] attribute.
[Description("This is a service description for thinger.")]
public class Thinger
{
}
We are creating an application in C# that uses CMIS to query remote repositories (Sharepoint, alfresco, etc.). My colleague set up the service references and we're able to connect and retrieve basic information. My part is to implement searching using the DiscoveryService.query. The issue is that the service that was represented in C# doesn't match the service documentation (found at http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html#_Toc243905469).
Apparently when generating the service, an additional parameter is added at the end of the parameter string (XmlAttribute[] anyAttr) for DiscoveryServicePortClient.query.
I've searched high and low over the web and can't find a single instance of this issue.
Have you been successful in integrating CMIS w/ C# and searching the remote repository? If so, how did you create your service references and what did you pass in as your parameters? Any assistance would be greatly appreciated as not only is my head hurting, but there's a huge hole in the wall where I've been banging it for the past two days. (If there's add'l information needed, just ask and I'll add it to this post.)
Apache Chemistry DotCMIS is a .Net client library for CMIS.
If you don't want use it, you can at least have a look at the source code.