on 11-02-2020 12:07 PM
entity T_QUESTION {
key Q_ID : UUID;
SESSION : String(150);
QUESTION : String(2000);
USER : String(256);
Q_GEN_TMSTMP : Timestamp @cds.on.insert : $now;
ANSWERS : Composition of many T_ANSWER
on ANSWERS.QUESTION = $self;
}
entity T_ANSWER {
key A_ID : UUID;
SESSION : String(150);
QUESTION : Association to T_QUESTION;
ANSWER : String(4000);
USER : String(256);
A_GEN_TMSTMP : Timestamp @cds.on.insert : $now;
}
service QA {
entity questions as projection on rbei.T_QUESTION;
entity answers as projection on rbei.T_ANSWER;
}
when trying to pass a POST request on answers. I'm getting an error.
axios.post('url/qa/answers',{
"SESSION":session,
"QUESTION": qid,
"ANSWER":answer,
"USER":user
})
Error:
{"error":{"code":"null","message":"Error while deserializing payload. Value for structural type must be an object."}}
can anyone correct this and help me with the payload.
Thank you.
Pratheek.
First of all I would suggest that you check out the CAP Naming Conventions. Then check out the example in the HTTP Client script: tests/catalog.http#L35. I think that the issue is with the QUESTION attribute. It should be QUESTION_Q_ID. But please check out also the Common Types & Aspects as they will help you to get your data model more elegant and short.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.