Getting null values from RESTFul Service

Avatar

Avatar
Boost 1
Level 2
sureshp23286254
Level 2

Like

1 like

Total Posts

20 posts

Correct reply

1 solution
Top badges earned
Boost 1
Validate 1
Ignite 3
Ignite 1
Give Back
View profile

Avatar
Boost 1
Level 2
sureshp23286254
Level 2

Like

1 like

Total Posts

20 posts

Correct reply

1 solution
Top badges earned
Boost 1
Validate 1
Ignite 3
Ignite 1
Give Back
View profile
sureshp23286254
Level 2

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

Avatar

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

392 likes

Total Posts

378 posts

Correct reply

148 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

392 likes

Total Posts

378 posts

Correct reply

148 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
vanegi
Employee

17-07-2020

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

20-07-2020

Moved this Q to AEM Forms