I'm trying to set up Data/Services in flash builder to connect to a RESTful API and as per usual Flash Builder attempts to scupper my efforts with it 'nearly but not quite' tools at every turn.
So I need to pass a POST request with a JSON string containing auth details to the URL:
https://myrestservice.com/rest/session/
For authentication to work I also need to add either:
A: an additional header containing: api_key = *my-api-key*
or
B: append the api key to the URL so: https://myrestservice.com/rest/session/?api_key=*my-api-key*
Simple right? Wrong. In the data/services tool for a custom http service there seems to be no way to add a custom header. Ok annoying as even a free chrome plugin can do this but hey I can live with that, I'll use option B. Wrong again. The URL field in Data/Services will ignore the query on the end of the URL. Seriously WTF. Am I missing something here?
So if I amend the auto-generated code in the super class and call it directly it works but if I try to take advantage of any of the tools the code is regenerated and overwrites my changes. Test Operation never works either.
I know there is a second class which is supposed to be used to extended and override the super class but only certain overrides seem to work so for example:
This works:
._serviceControl.baseurl = ("https://someotherurl.com")
This doesn't work:
._serviceControl.headers = ({"api_key = *my-api-key*"})
Oh and Test operation only seems to execute the super class. Once again a brick wall.
Working with flash builder seems to be 50pc coding 50pc deciding if it's a bug in your code or flash builder f*****g you over.
Any thoughts, workarounds, am I missing something would be much appreciated.
Thanks