0

I came across this article, which states that a language copy can be created with an API call like this:

POST https://tenant.sharepoint.com/sites/sitename/_api/sitepages/pages(<Source page ID>)/translations/create 

The request body should be like this:

{ "request": { "__metadata": { "type": "SP.TranslationStatusCreationRequest" }, "LanguageCodes": { "results": ["nl-nl"] } } } 

This is not working for me, I get an error on this. More exactly, it creates a language copy for all available languages (despite the error message), while I need to create a language copy only for the specified language.

Here's the error:

{ "error": { "code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException", "message": { "lang": "en-US", "value": "The type SP.TranslationStatusCollection does not support HTTP PATCH method." } } } 

I tried a bunch of bodies to no avail (found this as well, changed set to create but runs into the same error).

What would be the correct request body?

1 Answer 1

0

Solved it. The call needs exactly these three headers with the correct values:

Accept: application/json; odata=verbose Content-Type: application/json; odata=verbose odata-version: 3.0 

Unlike many other POST requests to SharePoint, this doesn't need x-http-method nor if-match.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.