Ryan_Pierce | 2022-03-02 13:40:07 UTC | #1
Using the .NET platform API we're attempting to update a DataTable (Import-ReplaceAll) from a csv file saved on a remote server. The import job is created and sits in A WaitingForUpload status. It seems the uploadURI field is changed from the URI we provide to one that begins with https://apps.usw2.pure.cloud/uploads/v2/datatables?additionalInfo={base64 encoded string}
Is there a step or steps we are missing from this import process?
dataTableImportJob.ImportMode = DataTableImportJob.ImportModeEnum.Replaceall; dataTableImportJob.UploadURI = "{https URI to file}";//file access doesn't require authentication dataTableImportJob.Status = DataTableImportJob.StatusEnum.Processing;
ArchitectApi.PostFlowsDatatableImportJobs(tableId, dataTableImportJob)
I have successfully imported this same URI using the UI. Thanks for any help.
Jerome.Saint-Marc | 2022-03-04 12:46:48 UTC | #2
Hello,
The uploadURI does not work as you think. uploadURI is provided by Genesys Cloud (in the response), and this where you must then upload your file/data. It is a Genesys Cloud URI - not an external URI.
Checking what the Genesys Desktop does when importing data from a file: PostFlowsDatatableImportJobs is invoked (only ImportMode seems necessary - ReplaceAll). The response contains the importJobId and the uploadURI where you will need to upload your file/data/csv. You then upload your data with a POST to https://apps.usw2.pure.cloud/uploads/v2/datatables?additionalInfo={base64 encoded string} using multipart/form-data Content-Type.
Regards,
Ryan_Pierce | 2022-03-02 22:00:48 UTC | #3
@Jermoe.Saint-Marc,
Appreciate the help, that worked like a charm. Wasn't a lot of documentation on this topic.
Jared_gross | 2022-03-03 23:21:33 UTC | #4
@Jerome.Saint-Marc I am currently working on a similar issue, except I believe I'm having a problem with permissions. When I use the token generated by the Developer Tools Oauth, I am able to successfully do an import, but otherwise, I can't seem to figure out what permission to grant the oauth role of my application.
Do you know what roles/permissions are needed to create a token that allows this action?
I should also add that when I make the call I get a 200 OK with a correlationId returned, but the import status stays in WaitingForUpload
Thanks!
Jerome.Saint-Marc | 2022-03-04 09:40:20 UTC | #5
Hello,
What type of application are you running? A "standalone" code (e.g. nodejs) that leverages an OAuth Client Credentials Grant? Or a webapp (html/js page) - using an OAuth Client with Token Implicit Grant (user context)?
I have just tried using nodejs and leveraging an OAuth Client Credentials Grant client My OAuth Client Credentials Grant has a role assigned (which contains "Architect - DataTable - All Permissions"). The code creates the Import Job (via Platform API) and then uploads the file to the uploadURI (using axios npm and form-data npm). And it works fine.
Same with an html page - using an OAuth Token Implicit Grant client (the permissions/roles are then coming from what the current logged in user has) and it also works.
If your file is quite large, I'd recommend to try first with just few records. In case the issue is coming from there. Otherwise, you should investigate if something could be wrong in your POST multipart/form-data to the uploadURI. You can possibly contact Genesys Cloud Customer Care so they can help troubleshooting based on your correlationId. We don't have access to and can't investigate customer data from this dev forum.
Regards,
Jared_gross | 2022-03-04 14:52:27 UTC | #6
Hi @Jerome.Saint-Marc we are currently running a standalone nodejs application that has Architect - DataTable - All Permissions and nothing else. The file we are importing is a two line csv file, so it is likely not a file size issue.
We temporarily applied the master admin role to the application and it worked, which seems to confirm that we are missing permissions. Do you know if anything in addition to the datatable permissions is required?
Jerome.Saint-Marc | 2022-03-04 15:38:51 UTC | #7
In my test with the OAuth Client Credentials Grant client, I have only set/enabled "Architect - DataTable - All Permissions". And that seemed to be enough (to create the import job and upload file - my code was not doing anything else).
Regards,
Jared_gross | 2022-03-04 21:54:16 UTC | #8
@Jerome.Saint-Marc I was able to resolve the issue. I think it may have had something to do with creating the import job with one oauth client and then posting the import with another. Thanks for the assistance!
system | 2022-04-04 21:54:36 UTC | #9
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 13764