How to create a DSP service which make a remote web service POST call with parameters?



I am stuck in a scenario, where I need to create a remote web service in DSP which makes a POST call to actual web service.

My issues:.
In DSP config what is base url( BaseURL )???
In swagger json, what are the values of ‘host’, ‘basePath’ and ‘schemes’ ?

I short, I need to access a remote web service:
with a payload:
“token” : “gfhiasgertttyy”

And I need a dsp service for the above call as shown below:
with a payload:
“token” : “gfhiasgertttyy”

How can I accomplish this?


@abhinavg first I would recommend reading DreamFactory guide to HTTP services.

The base URL for your service really depends on the service itself, typically I use the minimal URL required to use API. As an example lets take a look at NASA API.

The base URL is:

And the example query shown:

The ‘?’ shown starts the query as shown the parameter here is ‘api_key’.

The ‘api_key’ parameter is configurable inside DreamFactory as described in the DreamFactory docs.

For creating your Swagger I’ve found the easiest process to be testing the API using a REST client like Postman then saving my successful REST API calls to Postman collections then having this handy tool transform the collection in to Swagger for me. It may require some minimal tweaking to work inside DreamFactory but is much simpler then building from scratch. Hope this helps!


@abhinavg also the example URLs I provided above typically have https:// in front of them but forum wouldn’t allow me to place more than two links in my post as I’m new user.


Thanks Sasquatch. I will lookout apimatic. I have already read dreamfactory wiki and tutorials on adding a web service, but I couldn’t find an example to do a POST call. After the setting mentioned in dreamfactory docs when I tried to do POST on my newly created dreamfactory service(which in turn would do a POST request to external web service) using curl, I get the below error:
{"error":{"context":null,"message":"Undefined offset: 1","code":500, "trace":["..."] }

Also I cant get how to pass POST body to external web service ??
Here are the relevant screenshots.


@abhinavg This was a bug in earlier versions from what I can read on the internets. You might consider updating and testing again.


Well, I am using dreamfactory-2.3.0-4. It is the latest version. Hopefully someone can confirm that is it a bug in this version.


Here is my curl request:

curl -i -X POST --data “token=eyJ0eXAiOiJKI1NiJ9.eyJlbWFpbCIwNDJ9.gfzyPfJG9DCg” “” -H “X-DreamFactory-Api-Key: 4755…5cfbd2”

This should do:

successfully giving the response in JSON.
BUT it is not doing so. Anyone?


@abhinavg you are not using latest. See release notes:

Beginner - how to make a remote web service call?

@abhinavg you are not on the latest version @Sasquatch is correct updating to the latest 2.3.1 release resolves this.


Yep, I will try that and revert tomorrow.


With a fresh local bitnami install of 2.3.1 release, I tested POST request; and it is working fine so far. Thanks to @Sasquatch and @mattschaer.

BUT the GET request is not working on 2.3.1.

My curl request:
curl -i -k -3 -X GET “” -H “X-DreamFactory-Api-Key: 475…fbd2” -H “Content-Type: application/json” -H “Authorization: Bearer R35…gP”

This should do:

BUT the output is:

HTTP/1.1 400 Bad Request
Date: Sun, 23 Oct 2016 05:02:27 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Vary: Cookie
X-Powered-By: PHP/7.0.11
Cache-Control: no-cache
Content-Length: 89
Connection: close
Content-Type: application/json

{“error”:{“context”:null,“message”:“Invalid token: Wrong number of segments”,“code”:401}}

Any clues ?

Relevant screenshot:


Marking this thread as solved, and created new thread for GET request with Authorization Bearer header here.