adapter call

Calls an adapter procedure on the MobileFirst Server.

Syntax

Choose one of the following syntaxes.

mfp adapter call [<adapter>/<procedure> [--type|-t get|post] [--file|-f <args.json>]]

mfp adapter call [<adapter>/<procedure>
[--type|-t get|post]
[--form|-fp <form_parameters>]
[--header|-h <header_parameters>]
[--query|-q <query_parameters>]
]

Parameters

[--file|-f]
The JSON file that contains the required arguments.
[--type|-t]
Indicates the request type. Valid options: get or post. If you are using Java™ adapters, the type also includes put and delete.
Note: If the type parameter is not defined, the adapter call command uses get by default. Type cannot be passed in a JSON file.
[--form|-fp]
The form parameters to pass with the procedure. For Java Adapters and Direct Mode use only. Example: --form "username:user".
[--header|-h]
The header parameters to pass with the procedure. For Java Adapters and Direct Mode use only. Example: --header "password:pass".
[--query|-q]
The query parameters to pass with the procedure. For Java Adapters and Direct Mode use only. Example: --query "date:01/01/2015".

Usage

You can use the adapter call command in interactive mode or in direct mode.
Note: In direct mode, any string parameters, such as "stringParameter" in these examples, must have their quotation marks escaped, even if the string object is within an Array or Object object. Escaping string parameters is not necessary in interactive mode.
  • Interactive: $ mfp adapter call, then follow the prompts by using the arrow keys.
  • Direct with no parameters: $ mfp adapter call adapterName/procedure.
  • Direct with multiple parameters: $ mfp adapter call adapterName/procedure \"stringParameter\", 2, true.
  • Direct with an array: $ mfp adapter call adapterName/procedure [\"stringParameter\", 2, true]
  • Direct with a JSON file parameter: $ mfp adapter call adapterName/procedure --file ./myArgs.json
    JSON file
    [
      "world"
    ]
    JSON file for Java adapter
    {
      "FORM":{"username":"user","password":"pass"},
      "QUERY":{"index":6},
      "HEADER":{"Date":"01/01/2015"}
    }
  • Direct with POST method: $ mfp adapter call adapterName/procedure/{path_parameter} -fp "username:user1" --type post. To use the path parameters, add them to the adapter/procedure path. Replace the {path_parameter} with your value. For example:
    • Before: myAdapter/users/{username}
    • After: myAdapter/users/StanLee
  • Direct with Java adapter: $ mfp adapter call "adapterName/procedure/{pathParameter with space}" --form "username:user" --header "Date:01/01/2015" --query "index:6" --type post
Important: If the certificate of the server is not recognized as a trusted certificate, the following error is displayed when you run this command: Failed to retrieve runtime information: CERT_UNTRUSTED. To add your certificate to the list of trusted certificates, see Specifying a trusted SSL certificate.