Service set up but absolutely nothing happens in API Docs

I am a newbie to DF, so someone may be able to answer this question very easily. So sorry for my ignorance. I have a URL on my own server that spits out JSON data and uses a few parameters such as this

mysite.com/fileloadselectalltimesjson.php?stockcode=aa&callback=test&start=883612800000&end=1441778914000

It replies with a series of 5 numbers like this

["[883695600000,28.7960,29.9670,28.7960,29.9670]","[883954800000,29.6100,29.9670,29.5550,29.9670]", …

That works fine. So I created a service with those parameters in the config, added GET verbs ticked OUTBOUND (not sure I needed to but I tried it) . But when I go to API Docs and click on it nothing happens at all. I would have expected to have got a GET option and a Try it. Have I missed a crucial step? One thing I have not done is play around with the Service Definition. Would that be the reason?

They are currently

{
“resourcePath”: “/stocks”,
“produces”: [
“application/json”
],
“consumes”: [
“application/json”
],
“apis”: [],
“models”: {
“AddNew”: {
“id”: “AddNew”,
“subTypes”: []
}
}
}

Do I need to add parameters here? The JSON result from my external API are stock prices and they are Time, Open, Low, High, Close. How do I add them to the Service Definition Overview if that is the missing step? Or could it be something else like roles or CORS? Is there a error log I can see?

Any help much appreciated.

OK I changed the Service Definition Overview to this:-

{
“swaggerVersion”: “1.2”,
“apiVersion”: “1.0”,
“basePath”: “https://df-fairbairndata.enterprise.dreamfactory.com/”,
“resourcePath”: “/stocks”,
“produces”: [
“application/json”,
“application/xml”
],
“consumes”: [
“application/json”
],
“apis”: [
{
“path”: “/stocks”,
“description”: “Stock Prices”,
“operations”: [
{
“nickname”: “Stock Quotes”,
“method”: “GET”,
“summary”: “Get Stock quites”,
“notes”: “None”,
“event_name”: “MySQL_query”,
“parameters”: [
{
“name”: “StockCode”,
“type”: “string”,
“paramType”: “query”,
“description”: “Stock Code Abbreviated”,
“required”: true
}
]
}
]
}
],
“models”: {}
}

Still Nothing in API Docs. One thing I did notice is that if I select “raw” in the API Docs it show this, which is not the same as my Service Defintion

{“swaggerVersion”:“1.2”,“apiVersion”:“2.0”,“basePath”:“https://df-fairbairndata.enterprise.dreamfactory.com/api/v2",“resourcePath”:"/{name}",“produces”:[“application/json”,“application/xml”],“consumes”:[“application/json”,“application/xml”],“apis”:[],"models”:[]}

Is that a clue? Or should I simply not expect a Service like this to run in test mode under API Docs?

I’m looking for an example service definition for you.
However you should be able to call your service via any REST client without using API Docs. The service definitions are only for that Swagger interface, and do not affect an api’s actual functionality.

We include a very basic REST client with every instance, located at {instance base url}/test_rest.html
You can use your admin user credentials in the HTTP Auth username and HTTP Auth password fields.

Test Rest will enable you to test out the API without worrying about the service definitions.

Drew, thanks so much for the reply. I thought I was in the wilderness alone for a moment. I based my new service definition on the Rotten Tomatoes example…and as far as I can tell it is OK.

Is there anyway you could give me an example of a call to the DF instance. I am foggy about the admin user credentials and where they should go. In the header? And what is test_rest.html?

test rest is a tool we include for easily trying out rest calls to your instance. it’s located at {your dreamfactory base url}/test_rest.html
Example: I have an instance located here: https://tardis.enterprise.dreamfactory.com/dreamfactory/dist/#/login
Test Rest for that instance is located here:
https://tardis.enterprise.dreamfactory.com/test_rest.html

On that page there is a box for you to input your email and password for basic http authentication. See screenshot:

Excellent tool. Very close to get my service working now. Many thanks.

1 Like