Open sionjlewis opened 1 year ago
Hi About three weeks ago the following line of code is throwing an error:
GroupTranslationResponse translations = _helpCntrApi.Translations.ListTranslationsForArticle(articleID);
The error is as follows (minus organisation specific details):
System.Net.WebException HResult=0x80131509 Message=The remote server returned an error: (404) Not Found.Error content: {"error":"InvalidEndpoint","description":"Not found"} Resource String: /help_center/articles/6800012345678/translations.json + Transfer-Encoding: chunked Connection: keep-alive x-ua-compatible: IE=edge x-zendesk-api-version: v2 x-xss-protection: 1; mode=block x-frame-options: SAMEORIGIN x-rate-limit: 400 x-rate-limit-remaining: 390 x-zendesk-processed-host-header: ORGANISATION.zendesk.com strict-transport-security: max-age=31536000; x-zendesk-origin-server: help-center-unicorn-7b9cb75885-5crnb x-request-id: 7fe194ae19251c53-AKL x-runtime: 0.044152 CF-Cache-Status: DYNAMIC Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=MY%2BTOKEN"}],"group":"cf-nel","max_age":604800} NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800} CF-RAY: 7fe194ae19251c53-AKL Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Tue, 29 Aug 2023 03:06:55 GMT Set-Cookie: __cfruid=123eaa123ee4e12345baed4377b3df0293e59f23-1234567890; path=/; domain=.ORGANISATION.zendesk.com; HttpOnly; Secure; SameSite=None Server: cloudflare Source=ZendeskApi_v2 StackTrace: at ZendeskApi_v2.Core.RunRequest(String resource, String requestMethod, Object body, Nullable1 timeout, Dictionary2 formParameters) at ZendeskApi_v2.Core.RunRequest[T](String resource, String requestMethod, Object body, Nullable1 timeout, Dictionary2 formParameters) at ZendeskApi_v2.Core.GenericGet[T](String resource) at ZendeskApi_v2.Requests.HelpCenter.Translations.ListTranslationsForArticle(Int64 articleId) at PublishHelp.ZenDesk.UploadDocuments(ClientContext ctx, FileCollection files, Category category, Section section, String subsection, Int32 suborder) in C:_ILDS-Code\Cloud.InfoHub\PublishHelp\ZenDesk.cs:line 336 This exception was originally thrown at this call stack: [External Code] Inner Exception 1: WebException: The remote server returned an error: (404) Not Found.
System.Net.WebException HResult=0x80131509 Message=The remote server returned an error: (404) Not Found.Error content: {"error":"InvalidEndpoint","description":"Not found"} Resource String: /help_center/articles/6800012345678/translations.json + Transfer-Encoding: chunked Connection: keep-alive x-ua-compatible: IE=edge x-zendesk-api-version: v2 x-xss-protection: 1; mode=block x-frame-options: SAMEORIGIN x-rate-limit: 400 x-rate-limit-remaining: 390 x-zendesk-processed-host-header: ORGANISATION.zendesk.com strict-transport-security: max-age=31536000; x-zendesk-origin-server: help-center-unicorn-7b9cb75885-5crnb x-request-id: 7fe194ae19251c53-AKL x-runtime: 0.044152 CF-Cache-Status: DYNAMIC Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=MY%2BTOKEN"}],"group":"cf-nel","max_age":604800} NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800} CF-RAY: 7fe194ae19251c53-AKL Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Tue, 29 Aug 2023 03:06:55 GMT Set-Cookie: __cfruid=123eaa123ee4e12345baed4377b3df0293e59f23-1234567890; path=/; domain=.ORGANISATION.zendesk.com; HttpOnly; Secure; SameSite=None Server: cloudflare
Source=ZendeskApi_v2 StackTrace: at ZendeskApi_v2.Core.RunRequest(String resource, String requestMethod, Object body, Nullable1 timeout, Dictionary2 formParameters) at ZendeskApi_v2.Core.RunRequest[T](String resource, String requestMethod, Object body, Nullable1 timeout, Dictionary2 formParameters) at ZendeskApi_v2.Core.GenericGet[T](String resource) at ZendeskApi_v2.Requests.HelpCenter.Translations.ListTranslationsForArticle(Int64 articleId) at PublishHelp.ZenDesk.UploadDocuments(ClientContext ctx, FileCollection files, Category category, Section section, String subsection, Int32 suborder) in C:_ILDS-Code\Cloud.InfoHub\PublishHelp\ZenDesk.cs:line 336
1 timeout, Dictionary
This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: WebException: The remote server returned an error: (404) Not Found.
The code above the error seem to be working OK.
We are declaring global variables as the top of our class:
private const string _zenLocale = "en-nz"; private ZendeskApi _zenApi = null; private IHelpCenterApi _helpCntrApi = null;
private const string _zenLocale = "en-nz";
private ZendeskApi _zenApi = null;
private IHelpCenterApi _helpCntrApi = null;
Instantiating the objects with the constructor:
_zenApi = new ZendeskApi(zenUrl, zenLogin, zenToken, _zenLocale); _helpCntrApi = _zenApi.HelpCenter;
_zenApi = new ZendeskApi(zenUrl, zenLogin, zenToken, _zenLocale);
_helpCntrApi = _zenApi.HelpCenter;
We do the stuff specific to our organisation, before get the article ID and then run the code that errors...
Int64 articleID = (long)article.Id; GroupTranslationResponse translations = _helpCntrApi.Translations.ListTranslationsForArticle(articleID); foreach (Translation translation in translations.Translations) { translation.Body = contents; _helpCntrApi.Translations.UpdateArticleTranslation(translation); }
Int64 articleID = (long)article.Id;
foreach (Translation translation in translations.Translations)
{
translation.Body = contents;
_helpCntrApi.Translations.UpdateArticleTranslation(translation);
}
If I craft the URL to be what I would expect the Translations.UpdateArticleTranslation(() method to use (see example below), and past into my browser, I see a lovely JSON response
https://ORGANISATION.zendesk.com/api/v2/help_center/articles/6800012345678/translations.json
Here is the JSON example:
{"translations":[{"id":6800087654321,"url":"https://ORGANISATION.zendesk.com/api/v2/help_center/articles/6800012345678/translations/en-nz","html_url":"https://customersuccess.ORGANISATION.com/hc/en-nz/articles/6800012345678","source_id":6800012345678,"source_type":"Article","locale":"en-nz","title":"Our Application Title","body":"\u003cbody\u003e\r\n\r\n\t\r\n\t\t\u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" ... ,"page":1,"previous_page":null,"next_page":null,"per_page":100,"page_count":1,"count":1}
{"translations":[{"id":6800087654321,"url":"https://ORGANISATION.zendesk.com/api/v2/help_center/articles/6800012345678/translations/en-nz","html_url":"https://customersuccess.ORGANISATION.com/hc/en-nz/articles/6800012345678","source_id":6800012345678,"source_type":"Article","locale":"en-nz","title":"Our Application Title","body":"\u003cbody\u003e\r\n\r\n\t\r\n\t\t\u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"
...
,"page":1,"previous_page":null,"next_page":null,"per_page":100,"page_count":1,"count":1}
Hi About three weeks ago the following line of code is throwing an error:
GroupTranslationResponse translations = _helpCntrApi.Translations.ListTranslationsForArticle(articleID);
The error is as follows (minus organisation specific details):
The code above the error seem to be working OK.
We are declaring global variables as the top of our class:
private const string _zenLocale = "en-nz";
private ZendeskApi _zenApi = null;
private IHelpCenterApi _helpCntrApi = null;
Instantiating the objects with the constructor:
_zenApi = new ZendeskApi(zenUrl, zenLogin, zenToken, _zenLocale);
_helpCntrApi = _zenApi.HelpCenter;
We do the stuff specific to our organisation, before get the article ID and then run the code that errors...
Int64 articleID = (long)article.Id;
GroupTranslationResponse translations = _helpCntrApi.Translations.ListTranslationsForArticle(articleID);
foreach (Translation translation in translations.Translations)
{
translation.Body = contents;
_helpCntrApi.Translations.UpdateArticleTranslation(translation);
}
If I craft the URL to be what I would expect the Translations.UpdateArticleTranslation(() method to use (see example below), and past into my browser, I see a lovely JSON response
Here is the JSON example:
{"translations":[{"id":6800087654321,"url":"https://ORGANISATION.zendesk.com/api/v2/help_center/articles/6800012345678/translations/en-nz","html_url":"https://customersuccess.ORGANISATION.com/hc/en-nz/articles/6800012345678","source_id":6800012345678,"source_type":"Article","locale":"en-nz","title":"Our Application Title","body":"\u003cbody\u003e\r\n\r\n\t\r\n\t\t\u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"
...
,"page":1,"previous_page":null,"next_page":null,"per_page":100,"page_count":1,"count":1}