Getting null values from RESTFul Service

Avatar

Avatar

sureshp23286254

Avatar

sureshp23286254

sureshp23286254

06-03-2020

Hi,

 We are currently on AEM 6.4.7 and installed Adaptive Forms from adobe-aemfd-win-pkg-5.1.66.zip

I've configured Restful DSN by providing swagger doc and created form data model and services.

Post is successfully inserting the record in ServiceNow table but get is always returning null value. Not sure if the json response from ServiceNow wrapped in "result" is causing this. I'm providing swagger json and also the response from ServiceNow. I'm very much  grateful if someone could go over them and suggest the required changes in the swagger definitions.

 

Swagger doc:

 

{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "Test Service",
"description": "API that uses a ServiceNow as an example to demonstrate features in the swagger-2.0 specification"
},
"host": "localdev.service-now.com",
"basePath": "/api/now/table",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"securityDefinitions": {
"basicAuth": {
"type": "basic"
}
},
"paths": {
"/u_impairment": {
"get": {
"operationId": "getImpairmentList",
"produces": [
"application/json"
],
"security": [
{
"basicAuth": []
}
],
"parameters": [
{
"name": "sysparm_limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer"
}
],
"responses": {
"200": {
"description": "Impairment response",
"schema": {

"$ref": "#/definitions/ImpairmentResponse"

}
}
}
},
"post": {
"description": "Report new Impairment. Duplicates are allowed",
"operationId": "Create",
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"description": "Report Impairment",
"required": true,
"schema": {
"$ref": "#/definitions/ReportImpairment"
}
}
],
"responses": {
"200": {
"description": "Impairment response",
"schema": {

"$ref": "#/definitions/ImpairmentResponse"

}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
}
},
"definitions": {
"ImpairmentResponse": {
"type": "object",
"properties": {
"result": {
"type":"array",
"items": {
"allOf": [
{
"$ref": "#/definitions/ReportImpairment"
},
{
"properties": {
"u_number": {
"type": "string"
},
"sys_id": {
"type": "string"
}
}
}
]
}
}
}
},
"ReportImpairment": {
"type": "object",
"properties": {
"u_email_address": {
"type": "string"
},
"u_facility_name": {
"type": "string"
},
"u_status": {
"type": "string"
},
"sys_created_on": {
"type": "string"
},
"sys_created_by": {
"type": "string"
}
}
},
"ErrorModel": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}

 

 

 

Response json from ServiceNow:

{"result": [
{
"u_email_address": "test123@gmail.com",
"u_facility_name": "test1",
"u_status": "new",
"sys_created_on": "2020-02-25 13:09:50",
"sys_created_by": "testing",
"sys_id": "0b7f4a351bcf0010b8fb2f89bd4bcbe7",
"u_number": "FIR0001007"

},
{
"u_email_address": "jonnytest@gmail.com",
"u_facility_name": "test123",
"u_status": "new",
"sys_created_on": "2020-03-01 13:09:50",
"sys_created_by": "testing",
"sys_id": "0e19c8fe1b5bc410b8fb2f89bd4bcb29",
"u_number": "FIR00010010"
}
]}

 

Replies

Highlighted

Avatar

Avatar

vanegi

Employee

Avatar

vanegi

Employee

vanegi
Employee

17-07-2020

Highlighted

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.5K

Likes

955

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.5K

Likes

955

Correct Answer

1.1K
kautuk_sahni
Community Manager

20-07-2020

Moved this Q to AEM Forms