sap-tutorials / Tutorials

Tutorials on sap.com
https://developers.sap.com/tutorial-navigator.html
Creative Commons Attribution 4.0 International
732 stars 778 forks source link

Generate Custom OData Client Library with SAP Cloud SDK's Generator #4156

Closed ahusemann closed 5 years ago

ahusemann commented 5 years ago

Tutorial URL: https://developers.sap.com/tutorials/cloudsdk-js-generator.html

Please specify the step you are referring to Step 6: Integrate with Express.js application (optional)

The call of http://localhost:8080/candidates always fails, this is due to a wrong path defined in step 4. The API is available under the path https://sandbox.api.sap.com/successfactors/odata/v2/Candidate according to the API Business Hub, but the request with settings from step 4 results in a call to https://sandbox.api.sap.com/odata/v2/Candidate which gives a 404 error.

Changing the json from step 4 to "{ "RCMCandidate": { "directoryName": "sfo-data-service", "servicePath": "/successfactors/odata/v2", "npmPackageName": "sfo-data-service" } }" and regenerating the client resolves the issue.

mr-flannery commented 5 years ago

Thanks for reporting this! This is indeed incorrect in the tutorial.

One small suggestion: instead of setting /successfactors/odata/v2 as service path and then calling .execute({ url: 'https://sandbox.api.sap.com' }), you can also move the /successfactors to the end of the url in the execute call. This has the advantage that you can resuse the generated code for integrating with a real Successfactors system (since /odata/v2 is the actual service path for that case).

ahusemann commented 5 years ago

Thanks for that quick response, actually that solution came to my mind as well. Your explanation, why the other approach fits better is convincing.

thecodester commented 5 years ago

Thank you for your feedback. The issue seems to be resolved, so I am closing the issue.

If you still have questions, feel free to reopen the issue.