0

Reading about the Metadata API, it looks like you have to

  1. download something special (the WSC?), and
  2. use Java

To query data from Salesforce tables, I could easily use Python, make HTTP requests with requests library, make a SOQL query, and it worked.

But to make a new table for some new custom object, I'm finding out I need the Metadata API, and for the Metadata API there's the extra hassle of either using some GUI, or needing the WSC and having to use a certain language.

So I'm not sure how I'd, for example, deploy a script somewhere which creates a custom Salesforce table to load data into.

Is what I'm doing, and assuming, correct? If so, can one not deploy code to some machine elsewhere and have it be able to create custom Salesforce tables?

  • 1
    You should be able to use the WSDL from any language. It can even be used from Apex. – Adrian Larson Jul 5 '17 at 19:37
  • Did you get my question about deploying a script to a remote machine? I'm not exactly sure how to phrase it, but the point being that these instructions (developer.salesforce.com/page/…) talk about going into a Salesforce dashboard, downloading things, running Terminal commands. But I want to have a script somewhere which can do this on its own, without me as a human touching it. And should work just by having API Keys, not requiring a dashboard login (so it works for organizations of my app that I only have keys for, no login). – tscizzle Jul 5 '17 at 19:59
0

You will want to download a Web Services Definition Language file (WSDL), but it does not need to be used in Java. WSDL is a language-agnostic protocol that is not specific to Java. You don't "need" a WSDL file, but then you have to go down a very dark, lonely path of writing your own XML payload that happens to conform to the SOAP standards. It's a lot easier to use tools that are already provided.

In your specific example, Python has Zeep that you can use to make WSDL-based call. You can also use WSDL in PHP, Perl, Ruby, C#, Node, and so many more modern languages.

If that's too much of a hassle, you could just as easily get your hands on Salesforce DX, which sets up everything you need, or download the Metadata Toolkit. At that point, you can just write CLI scripts to do the heavy lifting.

| improve this answer | |
  • Thanks for the response! So I can use Python instead of Java. What about getting the WSDL? I have the API Keys of clients for whom my script would make custom objects, but I don't have their logins (and we're talking about a script anyway, not a human who can "log in to a dashboard"). So I can't follow this guide (developer.salesforce.com/page/…) and "log into your organization and then click Your Name | Setup | App Setup | Develop | API" as it says to do in order to get the Metadata WSDL. – tscizzle Jul 5 '17 at 20:11
  • @tscizzle The WSDL is version specific (e.g. Summer '17 is what you'd get today), but is not org specific. You can use the WSDL from your own Developer Edition org. – sfdcfox Jul 5 '17 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.