Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Getting null values from RESTFul Service

Avatar

Level 2

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"
}
]}

 

4 Replies

Avatar

Administrator

Moved this Q to AEM Forms



Kautuk Sahni

Avatar

Level 3

Where is this? I need similar information but I can't find the other post anywhere.

Avatar

Level 1

Hi,

Were you able to make this work? How are you authenticating? We are only interested in writing to ServiceNow from AEM Forms. It looks like you have succeeded in doing that. Is that correct? Any help is appreciated.