SAP / SAP/python-pyodata

Multiple Issues with modify action for SAP SF OData API

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
268
Forks
100
PR merge metrics
No merged PRs in 30d

Description

I am using this library for developing a Python application that uses SAP SuccessFactors OData API. I spent last few days to resolve following issues with performing modify/update action but without any success. I finally came here to seek your help and suggestion. Please note that my application is already using this library for several OData query operations but I would prefer to use it also for update, create and delete operations too.

  • Single update request using "PUT" method is making the desired update into HttpError because the status code returned is 200 instead of 204. This is because the update_entity() function in the class EntitySetProxy expects it to be 204 always.

  • SAP SuccessFactors expects a custom method called "UPSERT" but the EntityModifyRequest class identifies it as invalid method.

  • Batch update request even with only one update changeset is failing with the "BadRequestException" (400) error : "Missing boundary delimiter at line '4'.". Code wise all looks good and as suggested in the usage guide. Also, the header as well as the body (prints as below in [] parentheses) of the batch request looks fine too. Could it be because of 2 line breaks on line 4 of the body?

Batch Req. Header: [{'Content-Type': 'multipart/mixed;boundary=batch_1850_4989_2562'}]
Batch Req. Body: [
--batch_1850_4989_2562
Content-Type: multipart/mixed;boundary=changeset_2364_6806_2818

--changeset_2364_6806_2818
Content-Type: application/http
Content-Transfer-Encoding:binary

PUT PickListValueV2(PickListV2_effectiveStartDate=datetime'2020-10-23T00:00:00',PickListV2_id='employeeGroup',externalCode='EX') HTTP/1.1
Accept: application/json
Content-Type: application/json

{"label_en_DEBUG": "External Employee", "status": "A"}
--changeset_2364_6806_2818--
--batch_1850_4989_2562--]
Sample Code:
SampleAppCode

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with EntitySetProxy.update_entity() and EntityModifyRequest, then reproduce the PUT, UPSERT, and batch update examples from the issue and usage guide. Check the generated batch body and response handling; done means 200 updates are accepted, UPSERT is recognized, and the single-change-set batch request is accepted without the boundary error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.