Docs Menu
User Guide / API Parameters

API Parameters.

These API parameters are the variable parts of a resource. These parameters determine the type of action that is to be taken on the resource. Every parameter variable has a name, value type, and optional description. While building an API these parameters have to be decided in advance and made to be present in the API endpoint and are used to influence the response.

The various types of parameters include

1. Default API Input Parameters

Header parameters These parameters are shown as request headers and are usually related to authorization. Here these parameters are represented as *requestheader. These parameters mostly include key-value pairs.

Query parameters - These are separated from the hierarchy parameters by a question mark and are placed in an URL. e.g. htt://syncloop.com?id=20&name=joe. Each parameter in the query string is separated by & character. On Syncloop workspace it is represented by the letter q.

Request body parameters These are included in the request body and are used to send and receive data via the REST API. These are represented as *payload. All the data that is passed as the request is accumulated in the payload.

Template/Path parameters - Set off within curly braces, path parameters are placed within the path of an endpoint just before the query string, and they provide developers with an effective way to pass parameters. e.g.: /url/{b=20}. These parameters include the path values and need to be explicitly defined in the workspace and then used in concatenation with the Alias field in the configuration dialog. This add a dynamic parameter in the path field.

Matrix parameters - They come in between the resource path and Query parameters and are separated from the hierarchy parameters by a semicolon.

Plain Parameters - These are parameters that are defined in a request and are easily accessible in API but are omitted when the request is submitted.

2. Default API Output Parameters.

These parameters are mostly HTTP response codes that provided in the table below

Root Properties

HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped into five classes:

  • Informational responses (100 - 199)
  • Successful responses (200 = 299)
  • Redirection messages (300 = 399)
  • Client error responses (400 = 499)
  • Server error responses (500 = 599)

These parameters are created as per their usage eg: *401 will be executed when there is a response error and so on. Therefore, the response codes need to be wisely selected.

The screenshot of the declaration of these parameters on Syncloop workspace is shown in the figure.

Root Properties

Exporting parameters to Open API JSON Format

Now as we have created input and output default parameters, it is time to export them in an Open API JSON Format.

Click on the publish tool at the top of thw workspace and a publish/Export dialog will be displayed.

Root Properties

At present the export is greater than OpenAPI 3.0.1 JSON format. While clicking on export button the JSON file will be downloaded on the local computer.

The JSON Code is as follows


{
    "openapi" : "3.0.1",
        "info" : {
          "title" : "",
          "description" : "",
          "version" : "latest"
        },
        "servers" : [ {
          "url" : "https://test.ekaapi.com",
          "description" : "Syncloop Server Machine"
        } ],
        "paths" : {
          "/packages.APITest.TestProdA.TestAPIA.main" : {
            "get" : {
              "summary" : "",
              "description" : "",
              "operationId" : "TestAPIA",
              "requestBody" : {
                "description" : "",
                "content" : {
                  "application/json" : {
                    "schema" : {
                      "type" : "object",
                      "properties" : {
                        "name" : {
                          "type" : "string",
                          "description" : ""
                        },
                        "arrTest" : {
                          "type" : "integerlist",
                          "description" : ""
                        },
                        "dteArray" : {
                          "type" : "array",
                          "description" : "",
                          "items" : {
                            "type" : "string",
                            "format" : "date"
                          }
                        },
                        "arBln" : {
                          "type" : "array",
                          "description" : "",
                          "items" : {
                            "type" : "boolean"
                          }
                        },
                        "objArr" : {
                          "type" : "array",
                          "description" : "",
                          "items" : {
                            "type" : "object"
                          }
                        },
                        "byteArr" : {
                          "type" : "bytelist",
                          "description" : ""
                        }
                      }
                    }
                  }
                }
              },
              "responses" : { },
              "security" : [ {
                "ApiKeyAuth" : [ "syncloop" ]
              } ]
            }
          }
        },
        "components" : {
          "securitySchemes" : {
            "ApiKeyAuth" : {
              "type" : "apiKey",
              "name" : "Authorization",
              "in" : "header"
            }
          }
        }
      }

All the input and output parameter are represented in JSON format and can be verified.