GetResponseJson
{
"packetId": 1,
"messages": [
{
"service": "httpClient",
"operation": "GET_RESPONSE_JSON",
"data": {
"serviceCode": 1,
"path": "path/to/resource",
"query": {
"1": "Player Name",
"2": 2235
},
"headers": {
"1": "Player Name",
"2": 2235
}
}
}
]
}
This operation retrieves a JSON document from an external web site.
Results
Name | Description |
---|---|
response | JSON formatted response |
Service | Operation |
---|---|
httpClient | GET_RESPONSE_JSON |
Method Parameters
Parameter | Description |
---|---|
serviceCode | Service code of the external service configured in the Cloud Code - Web Services section of the portal. |
path | Path to append to the Base URL of the service. |
query | Optional map of query values. |
headers | Optional map of extra headers. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
var serviceCode = "webService";
var path = "resource/dir";
var query = {
"parmName": "value"
};
var headers = {
"headerName": "value"
};
var httpClientProxy = bridge.getHttpClientServiceProxy();
var postResult = httpClientProxy.getResponseJson(serviceCode, path, query, headers);
if (postResult.status == 200) {
// Success!
}
{
"service": "httpClient",
"operation": "GET_RESPONSE_JSON",
"data": {
"serviceCode": "webService",
"path": "resource/dir",
"query": {
"parmName": "value"
},
"headers": {
"headerName": "value"
}
}
}
JSON Response
{
"packetId": 1,
"messageResponses": [
{
"status": 200,
"data": {
"response": {
"result": "Result content"
}
}
}
]
}