cancel
Showing results for 
Search instead for 
Did you mean: 

post/get requests to CAPM backend service

I533303
Advisor
Advisor
0 Kudos

I have created CAP project and deploy it to SCP CF environment with the model and service definition below

I tried to test my backend service API on post man . I create new entity using post request it works as shown below but when I use get request i don't find any entity from those I have created with post method

Accepted Solutions (0)

Answers (5)

Answers (5)

Prashant_1986
Explorer
0 Kudos

HI Mariam Id-Manssour,

My self-Prashanth I also facing a similar issue that you have faced was able to POST the data in the POSTMAN and the log of the created entry is not getting reflected in the GET Request of POSTMAN.

please let me know if you have solved this issue.

0 Kudos

HI Mariam,

I am trying to perform post request to CAPM backend service but getting error while posting .

I tried to post using postman as well as SAP Business studio.Attaching the screenshot for the same.

Can you please help me with my issue.

Thanks,

Harshal

david_kunz2
Advisor
Advisor
0 Kudos

Hi,

You need to provide a UUID value, that means you need to skip the quotes:

/MaintenanceRequests(ID=a33175c2-4e08-4a5a-93e4-6de98c7b83a5,IsActiveEntity=false)

Best regards,
David

liat_b
Employee
Employee
0 Kudos

Hi Mariam,

I think you could benefit from running this "locally". Business Application Studio allows you to test your service without deploying it first to CF. You can use a local db, or test with SAP HANA, and to send requests you can use an integrated rest client.

See more details here: https://cap.cloud.sap/docs/get-started/in-bastudio

Thanks,

Liat

mariya_yordanova
Explorer
0 Kudos

Hi Mariam,

did you specify the UUID generated from your first post request in the second one as ID. Instead of 'generated UUID' you have to type the real UUID

Could you attach a screenshot of your post request?

Best Regards

Maria

former_member729305
Participant
0 Kudos

Hi mariya.yordanova

I am having a similar issue currently - is it not possible to make PATCH/POST/PUT directly on active Entities?

see here:

https://answers.sap.com/questions/13320281/patch-call-is-returning-401-for-cap-service.html

I would be very grateful if you could take a look:)

Best Regards

spurkayastha
Explorer
0 Kudos

Hi mariya.yordanova,

We have tried the same approach as suggested by you, i.e. we have used the UUID generated from the first POST request to the second POST request as shown below:

/MaintenanceRequests(ID='a33175c2-4e08-4a5a-93e4-6de98c7b83a5',IsActiveEntity=false)/service.draft.d...

Where a33175c2-4e08-4a5a-93e4-6de98c7b83a5 is generated UUID from the first POST request.

But we still get the same error:

{ "error": { "code": "400", "message": "No 'Edm.Guid' value found for key 'ID'" }}Regards,Sangita

mariya_yordanova
Explorer
0 Kudos

Hi Mariam,

as I see the entity Offers is draft enabled. Your post request creates an entity in a draft table, the created entity is not activated. The get request reads all activated entites. You have to activate this entity in order to see the data by get. So please make a POST /Offers(ID='generated UUID',IsActiveEntity=false)/service.draft.draftActivate`.

Best Regards

Maria

I533303
Advisor
Advisor
0 Kudos

Hi mariya.yordanova ,

How can I activate the entity to see the data by get ? can I perform CRUD operation on offer entity without enabling draft ?

I tried to call the request : POST /Offers(ID='generated UUID',IsActiveEntity=false)/service.draft.draftActivate` and i get this response

{
 "error": {
 "code": "null",
 "message": "No 'Edm.Guid' value found for key 'ID'"
 }
}

Thank you

Mariam