Quantcast
Channel: DreamFactory Forum - Latest posts
Viewing all articles
Browse latest Browse all 5027

How to connect to a remote web service that provides tokens

$
0
0

No problem, change the json in service definition to this:

 {
  "swagger": "2.0",
  "info": {
    "version": "2.0",
    "title": "Remote WS Example",
    "description": "Remote ws example."
  },
  "paths": {
    "/remotews": {
      "get": {
        "tags": [
          "remotews"
        ],
        "description": "Get token.",
        "parameters": [
          {
            "name": "appid",
            "in": "query",
            "description": "application id",
            "type": "string",
            "required": true
          },
          {
            "name": "key",
            "in": "query",
            "description": "my secret key",
            "type": "string",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "$ref": "#/definitions/TokenSuccess"
            }
          },
          "default": {
            "description": "Error",
            "schema": {
              "$ref": "#/definitions/TokenError"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "TokenSuccess": {
      "type": "object",
      "properties": {
        "token": {
          "type": "string"
        }
      }
    },
    "TokenError": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32",
          "description": "Error code."
        },
        "message": {
          "type": "string",
          "description": "String description of the error."
        }
      }
    }
  },
  "parameters": {
    "app_id": {
      "name": "appid",
      "in": "query",
      "description": "application id",
      "required": true,
      "type": "string"
    },
    "secret_key": {
      "name": "key",
      "in": "query",
      "description": "my secret key",
      "required": true,
      "type": "string"
    }
  }
}

I'm assuming that your Remote Service has the parameters appid and key


Viewing all articles
Browse latest Browse all 5027

Trending Articles