Solved

API Error when creating a PostgreSQL data source

  • 22 July 2022
  • 2 replies
  • 151 views

  • Known Participant
  • 11 replies

Hi, I'm not sure if anyone can help with this query. I'm currently using the GoodData API to set up a data source, but am receiving this error. It looks like "postgres" isn't a valid option for the connectionInfo even though the documentation says it is. Here is the error

{"response":{"error":{"errorClass":"com.gooddata.validator.openapi.spring.exception.MalformedRequestException","trace":"","message":"Malformed request: [ERROR - [Path '/dataSource/connectionInfo'] Instance failed to match exactly one schema (matched 0 out of 10): [/properties/dataSource/properties/connectionInfo/oneOf/0: Object instance has properties which are not allowed by the schema: [\"postgres\"], /properties/dataSource/properties/connectionInfo/oneOf/0: Object has missing required properties ([\"snowflake\"]), /properties/dataSource/properties/connectionInfo/oneOf/1: Object instance has properties which are not allowed by the schema: [\"postgres\"], /properties/dataSource/properties/connectionInfo/oneOf/1: Object has missing required properties ([\"redshift\"]), /properties/dataSource/properties/connectionInfo/oneOf/2: Object instance has properties which are not allowed by the schema: [\"postgres\"], /properties/dataSource/properties/connectionInfo/oneOf/2: Object has missing required properties ([\"bigQuery\"]), /properties/dataSource/properties/connectionInfo/oneOf/3: Instance failed to match exactly one schema (matched 0 out of 1), /properties/dataSource/p...","component":"load-restapi","errorId":"61c101ea-4416-410d-9096-cda45245c0db","errorCode":"gdc702","parameters":[]}}} 

The request I’m sending to the API is

{
"dataSource": {
"name": "connectionname",
"connectionInfo": {
"postgres": {
"url": "jdbc:postgresql:\/\/example.com:5432",
"authentication": {
"basic": {
"userName": "username",
"password": "password"
}
},
"database": "database",
"schema": "public",
"sslMode": "verify-full"
}
}
}
}

Here is the relevant documentation: https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#tag/cloudresource/paths/~1gdc~1dataload~1dataSources/post

icon

Best answer by Boris 22 July 2022, 15:53

View original

2 replies

Userlevel 2

Hello,

The value postgres is valid.

Matter of fact, if I use the json exactly as you posted in a request to /gdc/dataload/dataSources a new data source is created successfully.

However if I for example remove the field password, so the json looks like following:

{
"dataSource": {
"name": "connectionname",
"connectionInfo": {
"postgres": {
"url": "jdbc:postgresql:\/\/example.com:5432",
"authentication": {
"basic": {
"userName": "username"
}
},
"database": "database",
"schema": "public",
"sslMode": "verify-full"
}
}
}
}

and I am receiving the same error as you. 

That leads me to conclusion, that there is a mismatch in the expected schema for the object of type postgres. Perhaps some special character or a typo?

 

Best regards,

Boris from GoodData Support team.

 

 

Thanks for your response, You were right, there was something preventing the username from being added to the JSON correctly and this was preventing the JSON from validating. All solved now. Thanks again.

Reply