Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Issues with modify action for SAP SF OData API #136

Open
sandevs opened this issue Oct 26, 2020 · 1 comment
Open

Multiple Issues with modify action for SAP SF OData API #136

sandevs opened this issue Oct 26, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@sandevs
Copy link

sandevs commented Oct 26, 2020

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

@phanak-sap
Copy link
Contributor

Hi @sandevs

While this lib should work ideally on any odata service, we initially developed it for S4HANA odata services. I am not sure at the moment why there is explicit check for HTTP 204, but maybe this is the reason why.

I think it should be ok to quick patch this -as is present in other methods. - by if response.status_code != HTTP_CODE_OK:

if response.status_code != 204:
.

Please create the PR and test the fix.. since your code is screenshot and not Gist/code comment, I don't in fact want to spent time for rewriting it for testing on my side. :)

If I understand this correctly, that should at least enable to move forward for single update requests. At the moment, not sure about the batch problem, this should be probably best as separate bug, ideally with code that reproduces the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants