Unable to set mandatory headers for ContactOriginData PATCH in batch mode - sap-cloud-sdk

According to the integration guide for Contacts OData the Sap-Cuan-SequenceId header is mandatory when updating a ContactOriginData record. When updating in singleton mode I am able to set this header as follows and it works without issue:
service
.updateContactOriginData(contact)
.withHeader("Sap-Cuan-SequenceId", "PatchUpdate")
.executeRequest(destination);
However, there is no option to set this header when performing the same update in batch mode:
service
.batch()
.beginChangeSet()
.updateContactOriginData(contact)
.withHeader(...) // this option does not exist
.endChangeSet()
.executeRequest(destination);
When I run the batch one my SAP Import Monitor shows the error:
Invalid content in field Sap-Cuan-SequenceId
Is it possible to set this header in batch mode and I'm just not seeing how? I am using version 3.39.0 of the SDK. Any help would be greatly appreciated!
Thanks!

This clearly looks like an implementation shortcoming. The SDK has a new API for OData BATCH in the OData v4 client which shouldn't have this issue. Mentioned service exposes OData v2 only and the OData v2 BATCH implementation has been historically different. For compatibility reasons, it has to be kept like this. We plan to provide a parallel implementation to align it with OData v4 and fix many minor and major inconsistencies.
If this is super urgent we can try to provide a workaround using the SDK's generic OData client otherwise create an issue in this GitHub repository and the SDK team will update you when the fix for adding headers is going to be released.

Related

How to change Microsoft.Azure.CognitiveServices.FormRecognizer v0.8.0-preview API endpoint to v.2.0.0?

I'm currently training a custom model (manual labeling) using the OCR labeling tool
I noticed the model was stored on the https:///formrecognizer/v2.0-preview/custom/models endpoint.
The Form Recognizer .NET SDK (Microsoft.Azure.CognitiveServices.FormRecognizer v0.8.0-preview) are currently directed to the v1.0.0-endpoint because the model id is not available when I executed a GET request to https:///formrecognizer/v2.0-preview/custom/models and It did exists on https:///formrecognizer/v1.0-preview/custom/models. Does anybody know how to fix this problem without having to implement the REST API manually all over again or waiting for the next version of nuget package to come out?
Any help would be appreciated!
You can check out this website for the code snippets of how to use the v2.0 REST API:
aka.ms/Form-aka.ms/Form-Recognizer/api
The current SDK only supports v1.0 release, but the SDK for v2.0 release is coming soon. Stay tuned.
The new Azure SDK Azure.AI.FormRecognizer preview library supporting Form Recognizer service version 2.0-preview is now available. Details on how to use it can be found in the package README.

SAP Cloud SDK CI/CD Pipeline: Usage with non S\4 Services

I am using SAP Cloud SDK (Java flavour) to create an extension application of SuccessFactors.
I sadly discovered that the Jenkins pipeline does not allow me to use any other service than the ones listed here: SCN Blog (scroll to the Appendix).
This does not make so much sense to me, as now the SDK can be used - and it is sponsored to be used by SAP - also with SaaS in its ecosystem, SuccessFactors being one of them.
Any hint? Can this check be somehow "bypassed"?
Thanks,
Roberto.
Please note that the blog post is quite old, have you verified your assumption that it does not work with SuccessFactors API?
Nonetheless, we recently introduced a configuration option which allows you to disable certain checks, cf https://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md#s4sdkqualitychecks
checkServices is what you would want to disable in your scenario.
As stated by Florian in the comment and following the Project Piper documentation, parameters "checkServices" and "customODataServices" can be used to customize the behavior of the pipeline when running upon a non-Business Hub API.
"checkServices: false" will completely deactivated the check, whereas "customODataServices: [ yourApiName ]" will skip the check just for the specified services.

Post Service call with Multiple records

I would like to know how to post multiple records to SAP using "BatchRequestBuilder" along with ChangeSet .I am using a custom odata service call(ODataCreateRequestBuilder),not using the VDM model. I did'nt get any blog or documentation to start with.
Can you please help me in this regard.
Updated:
Below is what I am trying to post to SAP
[{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""},{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""}]
SAP SDK version : 3.9.0
I have added below code with only one CreateRequest.
ChangeSet changeSet = new ChangeSetBuilder().addCreateRequest( ODataCreateRequestBuilder.withEntity(sapConfig.getServiceUrlRepriceList(),
sapConfig.getEntityRepriceList())
.withBodyAsMap(responseBody)
.build()).build();
BatchResult batchResult = BatchRequestBuilder.withService("URL?").addChangeSet(changeSet).build().execute(httpClient);
Can you let me know if this is correct.Also let me know what I have to pass in the service.Is it service URL?
Thanks,
Arun Pai
The BatchRequestBuilder is actually not directly part of the SAP Cloud SDK but a dependency that the SDK internally uses to execute batch requests. That is why on the SDK level there is no documentation on how to use it.
Roughly, a batch request comprises of multiple change sets which in turn group together multiple operations. The ChangeSetBuilder allows you to build up change sets which you can then pass to a BatchRequestBuilder.
So if you want to run create requests in batch mode you would want to leverage public ChangeSetBuilder addCreateRequest(ODataCreateRequest oDataCreateRequest).
You can take a look at how the SAP Cloud SDK uses these classes to build up batch requests to get an idea how it works in detail. As a starting point look towards BatchFluentHelperBasic. However, unless you don't know the service you want to query at compile time, I recommend that you leverage the generator to generate this code so that you can use the VDM instead which simplifies this.
If you extend your question to hold more specific information on what you actually want to achieve I can expand my answer to give a more concrete example. Also please include the SDK version you are using.

Is Azure Storage REST API version "2015-07-08" used by storage client v7 documented anywhere?

I went to update the Azure storage client nuget here, and before pulling it read the changelog. In the changelog they say "support for 2015-07-08 REST version. Please see our REST API documentation and blogs for information...". I have looked all over and can't find any documentation for that API version (2015-07-08) of what was changed. Does anyone know what was changed and/or where the changes are documented?
Version 7.x of the client library is based on version 2015-07-08 (the latest version). However, the change to the service with this version, as compared to version 2015-04-05, is very minor. The only change is the addition of the GetPageRangesDiff/GetPageRangesDiffAsync methods on CloudPageBlob. These methods support incremental snapshots (see https://azure.microsoft.com/documentation/articles/storage-incremental-snapshots/). There is no other change to the service.
Also see https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx for the change to Get Page Ranges.
We will provide information in the versioning section for 2015-07-08 soon.
Didn't find what was exactly changed, but I think the documentation refers to https://github.com/Azure/azure-storage-net/tree/master/Documentation and blogs at http://blogs.msdn.com/b/windowsazurestorage/.

Azure Machine Learning Recommendations API: Delete Build fails

I'm using Azure's Recommendations API to generate product recommendations. I'm keeping Recommendations up to date via an SSIS package that updates the data, creates a new build for the data, and if the build succeeds, deletes any previously existing builds.
The API documentation is straightforward, and everything works fine except one call in particular fails for me returning a HTTP 406 error (Not acceptable - Accept header doesn't match a response type supported by the server).
Has anyone successfully deleted a build via this API Call?
According to the documentation a Delete Build call should look like this:
Method=DELETE
{rootURI}/DeleteBuild?buildId=%27%27&apiVersion=%271.0%27
Andrew,
I just ran into this question... Did you resolve this issue?
In contrast with most of the functions, The datamarket version of the API requires a DELETE method to actually delete a build (as apposed to a GET) -- that may be the first thing to check.
Also, I want to make sure you are aware that the datamarket version of the API will be deprecated (please read the migration guide at https://azure.microsoft.com/en-us/documentation/articles/cognitive-services-migration-from-dm/ for more details). You should now be using the Recommendations API Cognitive Service (see https://www.microsoft.com/cognitive-services/en-us/recommendations-api ).
Either way, if you are still running into issue, feel free to contact us at mlapi#microsoft.com and we can check what may be wrong with your call.
Thanks!
Luis Cabrera
Recommendations API Program Manager

Resources