Problem with Import a Single File API Call
Using Postman, I am able to upload a file to a Wdata table. Upon import, its status is "STAGED." I am attempting to use the Wdata API to IMPORT this file to the table. I am trying to use the "Import a single file" Wdata API endpoint that takes the format "/api/v1/table/{tableId}/import." Here is my Postman URL call:
POST https://h.app.wdesk.com/s/wdata/prep/api/v1/table/?tableId=table_id_inserted_here/import
The API call requires a body consisting of an "ImportDto" object. Going by the documentation and using the imformation I retrieved from the file I uploaded, I am using the following as the body in the Postman call:
{
"columnMappings": {},
"delimiter": ",",
"fileId": "file_id_inserted_here",
"metadata": {},
"tags": "{}"
}
When I run this POST call, I get the following response:
{
"code": 400,
"body": [
"name must not be null",
"tableSchema must not be null",
"type must not be null"
]
}
From the response, it looks like it is asking for table information. If I provide the requested information (name, tableSchema, type), it actually creates a new Wdata table based on the schema provided and does not affect the file I'm trying to import at all. This is not the intention of this API call. I don't think it should be asking for that information, since the body ImportDto object does not include that information. Any suggestions on what I am doing wrong in this API call?
-
Hi Brett,
Thank you for your patience while I ran this question by some of our Wdata experts! They stated that it looks like tableId is being used as a query parameter instead of just part of the path. To fix this, they recommend trying to use this formatting to import instead: https://h.app.wdesk.com/s/wdata/prep/api/v1/table/table_id_inserted_here/import
If you have any questions or need further guidance, just let us know!
1Liz Walters This solution solved our issue, thank you for your help!
0Please sign in to leave a comment.
Comments
2 comments