-
15. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 27, 2016 7:35 AM (in response to m.ardito)Meanwhile, I just filed this
[TEIID-4354] patch to CXF no longer needed with new version of the CXF in 9.0 series. - JBoss Issue TrackerMarco
-
16. Re: Need to get data from Mailup email marketing platform
rareddy Jul 27, 2016 1:17 PM (in response to m.ardito)So, the request for the Access Token is being sent from the Teiid, however the remote server (mailup) is throwing an exception for that request. There are no details to see what may be the issue.
There is tools like Wireshark that you can use to see what is being sent and received, but this can get very low level. If your account to mailup is just a dummy one, you can send me in private email the access codes, I can try locally and see what is wrong. Otherwise I do not know how else to proceed.
-
17. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 27, 2016 1:46 PM (in response to rareddy)Really there is no way to make teiid dump the request, no log level can do this?
In php I dumped all such requests to be sure of what is sent/received.
Mailup also offers a Java Rest API Client on https://github.com/mailup/rest-samples-java
if this can help to spot what is not working whan Teiid requests the services.
I'll see what I can do to make you access mailup service, anyway they have free developers accounts, as also explained here http://help.mailup.com/display/mailupapi/REST+API
Get a Developer Account - MailUp API - MailUp Docs
Also helpful: http://help.mailup.com/display/mailupapi/All+API+Keys+and+Endpoints+in+one+page
Marco
edit: btw, how can I PM you here?
-
18. Re: Need to get data from Mailup email marketing platform
rareddy Jul 27, 2016 3:19 PM (in response to m.ardito)We use CXF for the HTTP layer, thus my comment. Actually there is way to turn on CXF http logs. See Web Service Data Sources · Teiid Documentation "logging" section. Since this is a https call not sure it will show any useful information or not. I believe you can see at leaset see the headers etc.
You will find my email in my profile, click on the name.
-
19. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 28, 2016 4:15 AM (in response to rareddy)I tried asking some support to MailUP
Meanwhile I tried using SoapUI to test the service, and it seems to get the same result (it's the first time I use SoapUI so I can also be making mistakes):
the request made, after getting access token from server, to:
https://services.mailup.com/API/v1.1/Rest/ConsoleService.svc/Console/User/Lists
with headers:
====================
GET https://services.mailup.com/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Accept: application/json
Content-length: 0
Authorization: Bearer 2b2D0F0y3z0T1G0D1J3S3y242s0u0v2k2p2S1R2S263p0k250J0K3E2r0N120e0E3l2S0o0d1p0K411j0t0N1P1t2V1j2E3O2T3j1g2w2l242R0o0T2r1K2F0f34092w
Host: services.mailup.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
====================
fails, giving an HTML error page,
here is my current SoapUI setup.
-
20. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 28, 2016 8:26 AM (in response to m.ardito)Now it is working in SoapUI (I don't know if something has been done on mailup side)
But here there is a HEADER
Authorization: Bearer 2b2D0F0y3z0T1G0D1J3S3y242s0u0v2k2p2S1R2S263p0k250J0K3E2r0N120e0E3l2S0o0d1p0K411j0t0N1P1t2V1j2E3O2T3j1g2w2l242R0o0T2r1K2F0f34092w
that contains the ath token, and I can't obviously put this in the VDB (invokeHTTP method), each time...
Should another method be used or?
-
21. Re: Need to get data from Mailup email marketing platform
rareddy Jul 28, 2016 10:30 AM (in response to m.ardito)Marco,
The communication between client and Mailup, is like this. In this case Teiid, using the Refresh-token, client-id, client-secret it will ask for "accesstoken" once that is retrieved then it will use that to request the actual query. The first step to requesting the access token is failing for some reason. In SoapUI, it looks like somehow you avoided that step and got the access-token. (may be that get token does that)
Is this mailup a paid service? If I can create a account, may be I can try to see what is wrong.
Ramesh.. -
22. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 28, 2016 11:16 AM (in response to rareddy)Yes, but following the "expose twitter" example, the invokeHTTP method sends headers too (now from the client, later in a vdb view, I hope), but it seems that mailup requires also an Authorization header (giving the access token). Now, I tried with or without adding that Authorization header in the invooke HTTP, but it doesn't work.
edit: btw the mailup support also said "timezone is zulu" (afaik, it means GMT): could this be involved somehow?
Php code works, and SoapUI now works, so I think something in Teiid is not (yet) working. I don't know if it is the authorization/authentication step, to get an access token, or later, passing the access token along with other invokeHTTP details... or both.
As I said before, you can create a permanent developer account for free (also has limited mail sending capabilities to try out applications), create one or more application (each with its own client id/secret), and use that to access the same or another account, retrieving lists, info, messages, etc.
see Re: Need to get data from Mailup email marketing platform above for details.
Tomorrow is my last day at work before summer holidays, I fear this must wait until september... but this must be done, soon or later. And maybe others will come in future.
Btw, I can't see your private email, I see this hovering your profile picture:
and I can't find any email in your profile page... maybe I'm blind
Marco
-
23. Re: Need to get data from Mailup email marketing platform
rareddy Jul 28, 2016 12:34 PM (in response to m.ardito)how did you get the access token manually from mailup? I created developer account.
-
24. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 28, 2016 1:08 PM (in response to rareddy)Well, after registering, I followed what this page says http://help.mailup.com/display/mailupapi/Get+a+Developer+Account
I entered the console and requested credentials for a "Test" application (sorry my version is italian, but it should be available in english too), and got my client id/secret (maybe I got an email confirmation, shortly).
Then,
1) in a browser I requested:
2) this redirected me on mailup login: where I must enter authentication: user/password af any mailup user, like:
3) after authentication I was redirected on this page:
4) After confirming that I was redirected on the page I put in 1) with a GET query appended, like:
http://www.apiform.to.it/?code=<a very long code>&token_type=bearer&expires_in=3600&state=Auth+URL
5) using that code, I requested
https://services.mailup.com/Authorization/OAuth/Token?code=<the very long code>&grant_type=authorization_code&client_id=<my client id>&client_secret=<my client secret>
6) after the above request, I got a json response like:
{"access_token":"<a very long token>","expires_in":900,"refresh_token":"<another very long token>"}
And then used access/refresh code everywhere...
It's something similar to what I did for google spreadsheet datasource following Teiid documentation
I hope it's clearer now...
-
25. Re: Need to get data from Mailup email marketing platform
rareddy Jul 28, 2016 2:11 PM (in response to m.ardito)Try replacing the attached file in your WildFly installation in the "teiid-9.0.2/modules/system/layers/dv/org/jboss/teiid/security/main" directory, and restart and see if that works. I got through, but I have no data, so it was an empty result. If that works, then log JIRA saying "default token type needs to be "bearer" for OAuth2 access code negotiations. I will further dig up, what needs to be done.
-
teiid-jboss-security-9.0.2.jar 21.0 KB
-
-
26. Re: Need to get data from Mailup email marketing platform
rareddy Jul 28, 2016 2:14 PM (in response to rareddy)BTW, the issue is the response from MailUp from access token is not correct, see RFC 6749 - The OAuth 2.0 Authorization Framework it needs the token_type, but json response came back does not have it, and in Teiid we have not defaulted to "Bearer", which I did in the above patch.
-
27. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 29, 2016 3:27 AM (in response to rareddy)YES!!!!!!!!!!
The patch work now, and I also understand your comment above, now I've read that RFC part, and it is like you said:
"
4.2.2. Access Token Response
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of the redirection
URI using the "application/x-www-form-urlencoded" format, per
Appendix B:
access_token
REQUIRED. The access token issued by the authorization server.
token_type
REQUIRED. The type of the token issued as described in
Section 7.1. Value is case insensitive.
"
AND
"
7.1. Access Token Types
The access token type provides the client with the information
required to successfully utilize the access token to make a protected
resource request (along with type-specific attributes). The client
MUST NOT use an access token if it does not understand the token
type.
"
I appreciate very much your effort, and patience, Ramesh. I begun this thread as a total web services newbie, and now I feel I can build a solid experience, from now on: Thank you very much.
I'll file soon the JIRA issue, and notify Mailup of the RFC issue, I hope they can improve their server's response in future.
Marco
-
28. Re: Need to get data from Mailup email marketing platform
m.ardito Jul 29, 2016 3:56 AM (in response to rareddy)I got through, but I have no data, so it was an empty result.
If you wish to get some data, even if you just registered the free developer account, that account is (for testing purposes) usable as any other.
At least, you can get some info about the account itself using something like
select mup.* from
(call comunicazioni.invokeHTTP(
endpoint=>'https://services.mailup.com/API/v1.1/Rest/ConsoleService.svc/Console/Authentication/Info',
action=>'GET',
headers=>jsonObject('application/json' as "Content-Type", 'application/json' as "Accept",0 as "Content-length"))
) w,
XMLTABLE('/Items' passing JSONTOXML('Items', w.result) columns
company string PATH 'Company',
istrial string PATH 'IsTrial',
uid string PATH 'UID',
uname string PATH 'Username',
version string PATH 'Version'
) mup;