Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Gallery API and Enabling javascript

g_rose
7 - Meteor

I am trying to create a process to get all schedules on our company gallery to create a gantt chart. I am using python to generate my request url but copied the logic from a few different alteryx apps and macros I've found online. I believe I am correctly generating my oauth_signature and am receive a 200 response code when I plug my full url into postman or python requests package. However, the response I am getting is text/html rather than json even though I specify that:

headers = {'accept': 'application/json', 'content-type': 'application/json'}

 

In the html response that I do get, it says:

<h2>JavaScript Required</h2>
<p>It appears that JavaScript is either disabled in your browser, or is blocked by a plugin (such as NoScript). Please enable JavaScript on this site to continue.</p>
</div>

 

I am not sure how to address this. Is enabling javascript something I need to do on the machine that is running our private gallery lives on? Or is this a literal setting within the gallery server itself?

 

Any help would be greatly appreciated. I can also share my python code if that would be of any help.

7 REPLIES 7
patrick_digan
17 - Castor
17 - Castor

@g_rose  What url/endpoint are you hitting? Is it "/admin/v1/schedules/"? That response looks you're hitting the front end gallery as opposed to the api. 

g_rose
7 - Meteor

@patrick_diganI am using the /admin/v1/schedules endpoint.

 

I think I'm using the correct base url but that could my error. I connected to the machine that hoststhe gallery server. In the system setting, the base Address is shown as:

http://alteryx/gallery/

However, The actual url I use to log into the gallery via my browser is:

http://alteryx/gallery/#!

 

Our gallery is on an internal network so I suspect there is some rerouting/pointing where perhaps one of these urls is an alias for another?

 

 

patrick_digan
17 - Castor
17 - Castor

@g_rose  Have a look at my blog post over here. The url you should be hitting with the api is something like 

https://servername.domain.com/gallery/api/admin/v1/schedules/

 

For reference, the url for your gallery should look something like:

<a href="https://servername.domain.com/gallery/#" target="_blank">https://servername.domain.com/gallery/#</a>!
g_rose
7 - Meteor

@patrick_digan. I'm fairly sure that I am hitting our server. In the response header from my call, I get a few parameters that seem relevant. The server type being private, the version matching ours, and the gallery name matching ours (I assume this is the default for a new server and we never changed it) all make me think the url is correct.

 

{'X-ServerType': 'private',

 'X-ServerVersion': '2019.2.5.62427',      -this is the version our server is running

' 'X-Configuration': '{"allowAnonymousUsage":false,

                               "authenticationType":"alteryx",

                               "captchaKey":"",

                               "featureToggles":["F4666_SingleAccessPoint","F2455_InteractiveResults"],

                                "galleryName":"My "Company's 'Gallery",

                                 "jobResultsTtl":null,

                                 "serverType":"private",

                                "showMigration":false

                                 ,"showScheduler":true

                                ,"signupDisabled":false,

                                "smtpEnabled":true,

                                "useCustomLogo":true}

 

 

g_rose
7 - Meteor

I also tried changing my url to use the actual IP address of the machine and I received the same 200 response code with the same headers. but no data and ony text/html response type rather than the specified application/json

patrick_digan
17 - Castor
17 - Castor

@g_rose Does the macro from my blog post also not work for you? I'm using a version of that and it works on my end. Here is the full URL i'm going to:

<a href="https://server.domain.com/gallery/api/admin/v1/schedules/?oauth_consumer_key=MYKEY&oauth_nonce=000001&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1562168957&oauth_version=1.0&oauth_signature=Mysignature" target="_blank">https://server.domain.com/gallery/api/admin/v1/schedules/?oauth_consumer_key=MYKEY&oauth_nonce=000001&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1562168957&oauth_version=1.0&oauth_signature=Mysignature</a>

The server then responds with these headers, which seems different than the headers you're receiving.

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, Accept, Authorization
Access-Control-Max-Age: 1728000
Date: Wed, 03 Jul 2019 15:49:19 GMT

 Apart from trying my macro, I would also suggest using the api docs on your server to see what the difference is between your call and the api docs: https://server.domain.com/gallery/api-docs/

g_rose
7 - Meteor

I was able to get the macro working. The problem was that my actual gallery url was http://alteryx. I had to drop the /gallery/#! component that is necessary for getting to our server in a web browser. Thanks for the help!