Sending file content to ServiceNow DevOps config module from third party tool(GitLa) is not working

Sudarshan3
Tera Contributor

Hi All,

we are implementing the integration between GitLab cicd pipeline to ServiceNow DevOps config application. we have use case to send the config file content from GitLab repository to ServiceNow DevOps config data model (component).

we have refered the below CDM API document  to send the file content to ServiceNow DevOps config application.

CdmApplicationsApi (servicenow.com)CdmApplicationsApi (servicenow.com)

here we used below REST API endpoint call to send the config file content and its working fine as content is static in --data tag.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/components?namePath=%2FSettings%2FdbS..." \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:text/plain" \
--data "{
  \"dbIPAddress\": \"10.10.10.110\",
  \"dbPort\": \"8080\",
  \"dbConnectionString\": \"admin:admin server1.xyz.com:8080 dbName_payments\",
  \"dbConnectionStringBackup\": \"admin:admin server2.xyz.com dbName_payments_backup\
"}" \
--user 'username':'password'

 

however when we are sending the config  file contnet

from the configuration setting file as below (dynamic content), then its not uploading the the content from config setting file into the data model component.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/components?namePath=%2FSettings%2FdbS..." \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:text/plain" \

- configFilePath : "k8s/helm/values.yml"

-File_Content=$(cat "$configFilePath")

--data '{"'"$File_Content"'"}'

 

Please help to resolve this issue why the file content extracted from file not sent to the ServiceNow DevOps config application. or suggest if there is missing any parameter or syntax in the API call.

 

Thanks in Advance!

0 REPLIES 0