Problem testing a POST call in a CRUD

Posted by untipet on 21-Mar-2019 07:50

We are trying to implement a simple CRUD for some tables in our system based in Progress. We are trying to use json objects to interact with the system, and the methods that interacts with the database is expecting datasets as the structure to get or put data into the db. 

We have defined a Rest service for all the operations.

Now we have the get method implemented to get all the elements or just the result of a filter and is working fine. for example:

For the url filtering the ítem with id = 1 we get this response:

{
"dsTableName":
{
"prods:hasChanges":true,
"ttTableName":[{
"id":"1",
"field1":"value1",
"field2":"value2",
"field3":"value3"}],
"prods:before":{}
}
}

But we are having some problems with the post method to put a row into the db.
We try to call to the url and pass a json object with the same values than the showed above without the prods:before line. We expected that the system will throw an error because the id 1 is already taken, but we allways get the error "JSON value of ProDataset or temp-table parameter is invalid or empty.".

So the json we are passing is wrong, but we don't know where the error is.

Ths json we are passing looks like this:

{
"dsTableName":
{
"prods:hasChanges":true,
"ttTableName":[{
"id":"1",
"field1":"value1",
"field2":"value2",
"field3":"value3"
}
}
Any idea?

Thanks in advance.

Posted by untipet on 21-Mar-2019 15:55

Thanks Tim,

It's for PASOE and the Project is REST type.

Fortunately I have found the solution here: knowledgebase.progress.com/.../REST-mapping-in-PDSOE-and-its-effects-on-the-JSON-payloads-for-dataset-Handle. I put the link becouse it could be helpful for anyone else.

All Replies

Posted by Tim Hutchens on 21-Mar-2019 13:07

Is this for PASOE or Classic AppServer?

What type of OpenEdge Project is this? WEB/REST/APSV

Do you have the service catalog (JSON file describing the capabilities of the REST service)? The service catalog should tell you what the POST endpoint is expecting.

Posted by untipet on 21-Mar-2019 15:55

Thanks Tim,

It's for PASOE and the Project is REST type.

Fortunately I have found the solution here: knowledgebase.progress.com/.../REST-mapping-in-PDSOE-and-its-effects-on-the-JSON-payloads-for-dataset-Handle. I put the link becouse it could be helpful for anyone else.

This thread is closed