1. Libby Engelbret
  2. PowerBuilder
  3. Friday, 13 March 2020 13:17 PM UTC

My client will be using Emma, a CRM application.  Emma has an API and there is a .net dll written to access the Emma API.  How can I use this API to make calls and return and send information from my PowerBuilder desktop application?  Is it possible to make the calls directly?  If so, how do I determine the syntax?  The Emma developers page just gives examples and provides API wrappers for PHP, Python, Ruby, .net, etc. (not PB).  Any help would be greatly appreciated.

 

Libby Engelbret Accepted Answer Pending Moderation
  1. Monday, 16 March 2020 21:06 PM UTC
  2. PowerBuilder
  3. # 1

Armeen,

When you say "wrap it as COM", can you point me to some documentation that will tell me how to do that?  I'm not able to wait until April. Thanks!

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 16 March 2020 21:32 PM UTC
It's a bit complicated and there isn't step-by-step instructions. So I still think it may be easier you figure out how to directly call their REST Web APIs. You also may want to consider hiring one of the Appeon consulting partners to help you with this: https://www.appeon.com/consultants/consulting-partners
  1. Helpful
There are no comments made yet.
Libby Engelbret Accepted Answer Pending Moderation
  1. Monday, 16 March 2020 15:54 PM UTC
  2. PowerBuilder
  3. # 2

Thanks for the reply.  I think I'm going to switch gears and use the .net wrapper they have.  I can compile this into a .dll and make calls to it but I have never added a .dll to a PB project before.  How do I go about doing this?  Thanks.

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 16 March 2020 16:50 PM UTC
With older versions of PowerBuilder, you will have to wrap it as COM. With PowerBuilder 2019 R2, it has a .NET DLL importer. PowerBuilder 2019 R2 is scheduled to release first week of April 2020.

Here is a short preview of this new feature: https://www.appeon.com/sites/default/files//pictures/developer/2019R2-Beta/csharp-libraries.gif
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Sunday, 15 March 2020 17:07 PM UTC
  2. PowerBuilder
  3. # 3

ok, you are looking for how to do authentication. they seem to only have PHP examples, which i am not familiar with. Check with the emma developer, but it might be HMAC Authentication that they are doing. You would need to get the actual rest request from them. Typically you send an auth header that is a value generated from the other headers and signed with HMAC.
I have done HMAC auth with azure, and it is certainly doable, but microsoft provides full documentation.

Comment
  1. mike S
  2. Monday, 16 March 2020 18:28 PM UTC
so i found something on here:

https://documenter.getpostman.com/view/278059/emma-api/6fTzk3m?version=latest



it appears that you use your public key as a username. so i think the authentication part would be something like this:



blob lblb_auth

CoderObject lcoder

HttpClient http



http = create HttpClient

lcoder = Create CoderObject



lblb_auth = Blob(ls_publickey + ":" + ls_privatekey, EncodingANSI!)

ls_auth = lcoder.Base64Encode ( lblb_auth )

ls_auth += 'Basic '



http.SetRequestHeader ( "Authorization", ls_auth)





fyi:

https://en.wikipedia.org/wiki/Basic_access_authentication

  1. Helpful
There are no comments made yet.
Libby Engelbret Accepted Answer Pending Moderation
  1. Sunday, 15 March 2020 14:45 PM UTC
  2. PowerBuilder
  3. # 4

Thanks for the response.  I had figured out that part, but the piece that I don't know about is how to provide the authentication keys.  I have a public and private key and I see in the examples that you have to send those in to be authenticated, but I can't figure out how to go about doing that.  I looked at JWTToken (or something like that, sorry, doing this from memory), but it needs a URL and I can't figure out what that would be for authentication.  I don't think it's just the base URL.

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Saturday, 14 March 2020 15:38 PM UTC
  2. PowerBuilder
  3. # 5

after a quick look at their site, i saw some example calls: (http://api.myemma.com/#)

Now we’ll need to set the URL for the API call. The endpoint for all of our API calls is https://api.e2ma.net/NOTE: You must use TLS version 1.1 or higher to connect. TLSv1 and all versions of SSL ciphers (e.g. SSLv2, SSLv3) are not supported.

// Set URL
$url = "https://api.e2ma.net/".$account_id."/members/add";

 

So, the main url is : https://api.e2ma.net

then just add the rest of the endpoint as per the specs

 

 

Comment
There are no comments made yet.
Libby Engelbret Accepted Answer Pending Moderation
  1. Friday, 13 March 2020 21:06 PM UTC
  2. PowerBuilder
  3. # 6

Thanks for the responses.  Yes, that is the documentation for the Emma API.  I need to provide a private and public key (which I have) to allow this to work but can't figure out what the endpoint of that would be and how to make the call.  Can anyone help?

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 13 March 2020 14:04 PM UTC
  2. PowerBuilder
  3. # 7

i assume this is the crm you are talking about:

http://api.myemma.com/

 

this provides the REST api call list.  You use the features in PB 2017/19 to make HTTP calls to their platform.

 

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 13 March 2020 13:28 PM UTC
  2. PowerBuilder
  3. # 8

Hi Libby, Emma API called from the .NET DLL - is that a RESTful API? If it is, then it is "straightforward" REST calls from PowerBuilder.

Otherwise, you may call the .NET assembly using "COM callable wrapper" via OLEObject. In upcoming PB 2019 R2, the new .NET interop allows you to call the .NET assembly directly instead of going through COM and OLEObject.

HTH /Michael

Comment
  1. Miguel Leeuwe
  2. Friday, 13 March 2020 13:49 PM UTC
Hi Michael, any news on when R2 is being released. I feel "kept in the dark" quite a bit lately. A few weeks ago we were told that "in a few weeks it might be released" but nothing, no estimate, nothing.

Maybe I should ask Appeon.
  1. Helpful
  1. Michael Kramer
  2. Friday, 13 March 2020 14:03 PM UTC
I don't believe there is a public release date. Last update I read has release a week closer than I expected.

You may get more precise info asking Appeon directly.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.