APi works fine from dashboard but not from external test harness

63 views
Skip to first unread message

jcor...@etsos.co.uk

unread,
Jun 30, 2015, 8:46:50 AM6/30/15
to taffy...@googlegroups.com
I've got our little API up and running nicely now but I'm trying to get it to work externally (as well as keep the dashboard there for clients for testing)

I've added

<rewrite>
            <rules>
                <rule name="api" enabled="false" stopProcessing="true">
                    <match url="^orders/(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="orders/index.cfm?endpoint=/{R:0}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
        <httpErrors existingResponse="PassThrough" />

to the web.config in the root of the subdomain which is api.etsos.co.uk

And I'm now trying to call the most basic of the calls from an external source, which should be

https://api.etsos.co.uk/orders/createQuickCase

I'm using basic auth for security and all that should be in the body is
{
   "matterReference": ""
}

But I keep getting a 500 error from Hurl.it and nothing in any of the logs to give me a clue as to what is actually going wrong.

Could anyone point me in the right direction?

Adam Tuttle

unread,
Jun 30, 2015, 8:56:53 AM6/30/15
to taffy...@googlegroups.com
Have you verified that it's an issue with your rewrite rules by trying your hurl.it request with the non-rewriting url pattern?

If we try that in the browser:


We see a 500 response, and an error message explaining that your onTaffyRequest() method is not returning a value (which it must do).

Get this working (and then test with a username and password for your basic auth) before you move on to rewriting.

Adam

--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jcor...@etsos.co.uk

unread,
Jun 30, 2015, 9:19:29 AM6/30/15
to taffy...@googlegroups.com
The return is fixed now ( just missed the return keyword on the failed authentication) but although that is working fine when you call it in the browser, and returns the correct .403 error, in hurl.it causes a 500 error with no explanation!

Thanks in advance for any more help

Adam Tuttle

unread,
Jun 30, 2015, 9:37:55 AM6/30/15
to taffy...@googlegroups.com
Can you give us a test username and password?

jcor...@etsos.co.uk

unread,
Jun 30, 2015, 9:41:47 AM6/30/15
to taffy...@googlegroups.com
Yes of course

TRAN5587A / 99demo33

Thanks

Joanne

jcor...@etsos.co.uk

unread,
Jul 1, 2015, 8:42:51 AM7/1/15
to taffy...@googlegroups.com
Thanks Adam for pointing me in the right direction, I've managed to get everything working fine from the external clients using the full URL

e.g. https://api.etsos.co.uk/orders/index.cfm?endpoint=/createQuickCase

Now I need it to work using the URLRewrite so that the above URL becomes

https://api.etsos.co.uk/orders/createQuickCase

I've tried the example given in the documents but URLRewrite is certainly not my forte and I'm struggling to work out an appropriate regex to get the application to behave as a subdomain and in a folder

Can anyone help?

jcor...@etsos.co.uk

unread,
Jul 1, 2015, 12:01:20 PM7/1/15
to taffy...@googlegroups.com
I've sorted it :)

<system.webServer>
        <directoryBrowse enabled="false" />
          <httpErrors existingResponse="PassThrough" errorMode="Custom" />
        <rewrite>
            <rules>
                <rule name="Rest API" stopProcessing="true">
                    <match url="^orders/(.*)$" />
                    <action type="Rewrite" url="/orders/index.cfm?endpoint=/{R:1}" logRewrittenUrl="true" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
Reply all
Reply to author
Forward
0 new messages