Having Trouble with my MS SQL Service API

I am VERY new to using web services and was finally starting to make progress until I got stuck again.

I am working in Android and using Retrofit connecting to MS SQL Server:

This works

http:/MYSERVERIP:85/rest/MYAPP?app_name=api-key

This does not:

http://MYSERVERIP:85/rest/MYAPP?names_only=true&include_schemas=true?app_name=api-key

Error in Android LOG CAT:

D/Retrofit﹕ java.io.IOException: No authentication challenges found

if I put it in a browser I get this:

{“error”:[{“context”:null,“message”:“No application name header or parameter value in request.”,“code”:400}]}

It runs fine and lists all the tables in the API Docs section of the admin console. Any help is appreciated.

I will answer my own question. The problem was with my header. If anyone else is using retrofit here is how I have mine working.

public interface dreamfactory {

@POST("/rest/user/session?app_name=MYAPPNAME")
public void authenticate(@Body Session auth, Callback<DreamfactoryModel> response);


@GET("/rest/MYAPPNAME?names_only=true&include_schemas=true")
public void getTables(@Query("app_name") String sessionId,@Header("X-DreamFactory-Session-Token") String sessionID, Callback<List<TableModel>> response);

}

This is just what I have been using to learn and test with but hopefully someone finds it useful.

1 Like