Proxy Set Config
Proxy Set Config - kintone.plugin.app.setProxyConfig()
Saves the plug-in configuration settings that can be later retrieved with the kintone.plugin.app.proxy() API.
Function
kintone.plugin.app.setProxyConfig(url, method, headers, data, successCallback)
Parameters
PARAMETER | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
url | String | Yes | Part or all of the REST API URL. Check the following section for conditions for data to be added to the API request: Conditions for Saved Data to be Added to the Request |
method | String | Yes | The HTTP method. Specify one of the following: GET / POST / PUT / DELETE. |
headers | Object | Yes | The parameters that will be added to the request header of the API. If parameter names overlap with parameters specified with kintone.plugin.app.proxy() , then the parameters specified here will take priority. For more information, refer to the following article:Plug-in Proxy Request Leave this as {} if parameters are not needed. |
data | Object | Yes | Specify data that will be added to the API request data, as an object with a set of key and values inside. Example: {If key names overlap with keys specified with kintone.plugin.app.proxy() , then the property values specified here will take priority. For more information, refer to the following article:Plug-in Proxy Request Leave this as {} if keys are not needed.Object type values cannot be specified as the property values. |
successCallback | Function | Optional | The function to be called after the settings have been successfully saved. There are no parameters. If this is undefined, null or is not specified, the page will navigate to the plug-in list page and display a message stating the settings have finished. If a callback function is specified, the page will not navigate to the plug-in list page. |
Returns
Nothing
Available Pages
This method can be used in the following pages:
- Plug-in Settings
Sample
|
|
After the above settings have been saved, let's say you used "kintone.plugin.app.proxy()" to run an API, with the URL https://api.example.com/rest/operate.json
and a header of {}
.
In this case, the request header that will be sent will become:
|
|
Saved Format
The data saved by this API will be saved in the following format:
- URL
- HTTP Method (GET/POST/PUT/DELETE)
- Saved Data
- An object will be saved with a set of keys and values including the following:
- Request Header
- Request Data
If you specify a URL and HTTP method set that's already been saved to the plug-in, the new information will override it.
Conditions for Saved Data to be Added to the Request
The saved information will be added to the requests that use kintone.plugin.app.proxy(), and also meet all of the following conditions:
- The apps are the same
- The Plug-ins are the same
- The HTTP method is the same
- The URL of the API that is called forward matches
Forward matching URL examples
Example 1
For example, if the below API and URL is used to save settings to the plug-in,
|
|
and the below API and URL is called to run an external REST API,
|
|
then the URLs will forward match, and the data saved in the plug-in (saved by kintone.plugin.app.setProxyConfig()
) will be added to the request.
Note that the URLs are case-sensitive.
Example 2
If you've saved several settings to the plug-in, the URL in the settings that match the most characters with the URL called by kintone.plugin.app.proxy() will be prioritized.
For example, let's say we used kintone.plugin.app.setProxyConfig()
to save the following two settings to the plug-in:
|
|
If we call kintone.plugin.app.proxy() to run an external REST API with the following information,
|
|
the request header that will be sent by the API will become:
|
|