im looking at api opened by Microsoft Translator Hub (Microsoft Translator Hub Api Swagger Link) and i cant figure out how to use the upload file part. The other operation ive managed to do but i cant figure out how to use the HubUpload operation.
For HubUpload/Get
public void GetStatusHubUpload(string accessToken)
{
var client = new RestClient("https://hub.microsofttranslator.com/api/HubUpload/Get");
var request = new RestRequest(Method.GET);
request.AddParameter("trackingId", /*Integer*/);// Not sure where to get tracking id - after upload?
request.AddHeader("Authorization", accessToken);
request.AddHeader("WorkspaceIdentifierHeader", workspaceid);
IRestResponse response = client.Execute(request);
HubApiUploadResult hubApiUploadResult = JsonConvert.DeserializeObject<HubApiUploadResult>(response.Content);
}
For HubUpload/Post -- How to include the excel file to be uploaded to dictionary? Whats the parameter name? Dont we need to specify the Project name as well? How does it know where to upload without giving this parameter (Inside swagger page, the only parameter specified is overwrite, Authorization and WorkspaceIdentifierHeader)?
Ive tried this one but getting internal server error
public void PostFile(string accessToken)
{
var client = new RestClient("https://hub.microsofttranslator.com/api/HubUpload/Post");
var request = new RestRequest(Method.POST);
request.AddParameter("projectname", "DemoTranslatorHub_En_Ar");
request.AddParameter("overwrite", "false");
request.AddHeader("Authorization", accessToken);
request.AddHeader("WorkspaceIdentifierHeader", workspaceId);
request.AddFile("content", @"excel file path");
IRestResponse response = client.Execute(request);
HubApiUploadResult hubApiUploadResult = JsonConvert.DeserializeObject<HubApiUploadResult>(response.Content);
}
Tqvm in advanced.