function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jimmy ArmstrongJimmy Armstrong 

Rest API for J2ME Mobile app

Hi,

 

I am planning to use the Rest API to access Salesforce from a J2ME device.

I cannot use OAUTH2 as I dont want a web application running on a mobile.

 

As another person suggested we can pass the sessionId to the Rest API. However to do so requires

SOAP libraries.

 

I am wondering :

 

1) Are SF Soap libraries compatible with J2ME?

2) Is there a way to get the sessionID by any other means to pass to REST based API instead of using SOAP?

 

I expected that the REST based api would accept the username/password/token and would return the session  ID but this seems not to be supported.

 

Thanks

-Jimmy

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Pat PattersonPat Patterson

There's a PHP code sample that does the OAuth username/password login in this discussion board message.The HTTP query URL is the same whether you're running PHP or Java, so you should be able to get it working from there.

 

It's worth reading through the rest of the thread for the instructions on allowing API access, and, also, please note that the REST API is still in developer preview and not for production use.

All Answers

SuperfellSuperfell

You can use the username/password oAuth2 flow. Or you can use the regular oauth2 flow with a custom URL scheme for the callback URL, these are fairly easy to hook in a lot of environments (i don't know about J2ME though)

Pat PattersonPat Patterson

There's a PHP code sample that does the OAuth username/password login in this discussion board message.The HTTP query URL is the same whether you're running PHP or Java, so you should be able to get it working from there.

 

It's worth reading through the rest of the thread for the instructions on allowing API access, and, also, please note that the REST API is still in developer preview and not for production use.

This was selected as the best answer
Jimmy ArmstrongJimmy Armstrong

Appreciate your help guys.

 

-Jimmy

Jimmy ArmstrongJimmy Armstrong

Hi,

 

Here's a link with the code to perform username/pwd flow of OAuth 2.0 in java

http://techstuffplus.blogspot.com/2011/01/rest-based-webservice-calls-to.html

 

Thanks

-Jimmy.