Superpatterns Pat Patterson on the Cloud, Identity and Single Malt Scotch

About

Pat Patterson

Dad, Husband, Developer Evangelist Architect for Salesforce.com

An outgoing creature of the species 'articulate techie', I work at salesforce.com, spreading the good word about the Salesforce Platform. I am an accomplished international public speaker, presenting at events such as Dreamforce, OSCON, JavaOne, the RSA Conference, Defrag, Gluecon and many more. I love to see the light bulbs illuminate above the audience's heads as they learn how the technology I'm presenting can apply to their situation.

Comments (12) Trackbacks (0)
  1. Hey, this blog looks pretty questionable, but I linked to it from http://petewarden.typepad.com/searchbrowser/2010/10/how-to-use-the-new-salesforce-rest-api-from-php.html

    I have your salesforce took kit and I see that it works with php 5.2 +. What options with salesforce API do I have with PHP Version 5.1.6

    Are there any other API options for php.

    Thanks in advance.

    Jake

  2. Hi Jake – re ‘questionable’ – yeah, I ought to go update my ‘About’ page. I’ll put that on my list for today.

    As for PHP 5.1.6… Unfortunately, the default behavior of PHP’s SOAP implementation is (in my opinion, but not the PHP folks) broken – see http://eirikhoem.wordpress.com/2008/03/13/array-problems-with-soap-and-php-updated/

    A configuration option ‘SOAP_SINGLE_ELEMENT_ARRAYS’ was introduced in PHP 5.2. Since PHP 5.1.x is no longer supported (indeed, the end-of-life for PHP 5.2.x was announced last December – http://www.php.net/archive/2010.php#id2010-12-16-1) I think your best option is to move to PHP 5.3.

    Sorry I can’t give you a better fix!

  3. Wow! A whole new site. hahah

    Thanks for the reply. I appreciate it. It looks like a server upgrade will be need to be queued shortly. Once that is done I may be back.

    (Sorry about the ‘comment’ on your about page. I thought it was a contact page. I will try to comment more appropriately in the future.)

  4. I spent a few minutes setting up a new theme and better text on the ‘About’ page :-) No problem leaving comments here – it all gets to me in the end ;-)

  5. Hi Pat, sorry for writing right here, but I didn’t find a better communication way.
    On this page http://blog.sforce.com/sforce/2011/03/calling-the-rest-api-from-javascript-in-visualforce-pages.html a proxy for JS API calls is described, with a wrapper lib to use it.
    But it doesn’t solve my problem, because I don’t host my JS app as a VisualForce page. Hence, a call to the proxy would still be cross-domain.

    The question is, why not just support CORS and set an HTTP header:
    Access-Control-Allow-Origin: *
    Then cross-domain API calls from JS would work from any domain, in all modern browsers.

  6. Hi Dmytro/Shedal, if you look at this page http://blog.sforce.com/sforce/2011/04/calling-the-rest-api-from-javascript-from-anywhere.html you can see a way to do this from your own site. Allowing ‘*’ on CORS is something we have to look carefully at – there may be security ramifications in opening it up that wide.

    As I said on the Force.com blog, we’re looking at this for a future release.

  7. I’m working on my first facebook app, and I’m following your example here:
    http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_Toolkit_for_Facebook,_Version_3.0

    to get some ideas and also to have my “first time” with FB environment and facebook toolkit 3 and fb apps in general.

    Using your code I’m receiving this kind of error:

    “sObject type ‘Facebook_Favorite__c’ is not supported. If you are attempting to use a custom object, be sure to append the ‘__c’ after the entity name”

    and i cannot find any solution. Also with the second part of the code there is something that the platform doesn’t like.

    Can u please help me ?

    Thanks a lot and I’m sorry to bother you!

    Kind regards, Giuseppe C.

  8. Hi Giuseppe! It sounds like you’ve created a custom object called ‘Facebook Favorite’, or something similar, but you’re not referring to it correctly in your code.

    Go to the object detail page for your custom object (Setup | App Setup | Create | Objects | {Your object name}) and check the API Name.

  9. Hey Pat,

    Really interesting stuff you have been working on. I am working with your http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_Toolkit_for_Facebook,_Version_3.0 and I believe version 3.3. There is a step in 3.2 where you put in a EncryptionSettings__c.Key. I haven’t been able to find too much documentation about what I should put in there or if it is made up or retrieved? Any help would be greatly appreciated!

    Thanks,
    Brandon

  10. Brandon – the code will create an encryption key the first time it needs to encrypt any data, and save the key in a custom setting – see the code at https://github.com/developerforce/Force.com-Toolkit-for-Facebook/blob/master/src/classes/FacebookCrypto.cls#L40

  11. I just worked through your “Getting Started with the Force.com REST API” tutorial using JAVA (https://developer.salesforce.com/page/Getting_Started_with_the_Force.com_REST_API#) and wanted to suggest some updates to the page. There are some errata in this page. The link to the JSON Java libraries is broken, but could be updated to https://code.google.com/p/org-json-java/downloads/list. Also, in the file DemoREST.java, the getString() function on lines 61 and 161 cause errors since they are run on non-strings; the function should be changed to optString(). Also, for people (like me) who want to learn REST but don’t have a Java development environment setup, it would be very helpful if the article linked to a complete tutorial about how to setup that development environment in the “Setting up for the Sample Application” section. A very straightforward tutorial is here: http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html. For novices it might also help if in the setup steps it said that the JSON and Apache libraries need to be “imported into” the project (instead of “added to”) and that the REST API sample code needs to be put in the project in with the project source files. Thanks!

  12. Hi Andrew – thanks for the feedback – I’ll revisit that article (It’s nearly 4 years old now!) and apply your suggestions.


Leave a comment

No trackbacks yet.