cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to retrieve the answerset (actual data not metadata information) from paxata

Highlighted
Linear Actuator
Hi,
We want to retrieve answerset from paxata and export to different system programmatically. Is there any way to retrieve/download the answerset actual data (not metadata information) from paxata?

Please provide curl command if this is achievable.

Regards,
Abhijeet
Labels (1)
0 Kudos
8 Replies
Highlighted
Image Sensor
Here's the curl command I use: 

curl -k -sS -u ":<TOKEN ID>" -H "loginTenant:<TENANT ID" -X POST "https://<PAXATA URL>/rest/library/exports?pretty=true" -F "format=separator" -F "dataFileId=<DATAFILE_ID"

You may not need the -k in your environment
0 Kudos
Highlighted
Linear Actuator
@ginoroy and @abhijeetmkhambe 
It's important to note that the POST method on /library/exports API is deprecated

To avoid breakage due to removal of the /library/exports API, use the /datasource/exports API
  • URL format: http://<paxata_host>/rest/datasource/exports/dataSourceId/dataFileId[/version][?itemPath=itemPath]
  • dataSourceId:  The ID of the data source defined in Paxata. You may need to list datasources by perfoming a GET against the /datasource/configs API
  • dataFileId: the ID of the datafile in the Paxata Library
  • format: one of [separator, fixed-width, avro, json, xml, excel]
  • itemPath:  path of exported item when exporting to a non-local datasource
Export a datafile in CSV format to your local host:
curl -sS -f -u ":<REST_TOKEN>" -X POST "http://<paxata_host>/rest/datasource/exports/local/aadd13cf65744606ad5842f1b7a22767?pretty=true" -F "format=separator" -F "tenantId=<tenantId>"

Export a datafile in XML format to the file /tmp/exported-text.xml a connected data source:

curl -sS -f -u ":<REST_TOKEN>" -X POST "https://<paxata_host>/rest/datasource/exports/2da34c162ed8439aa404ba1abfe7e33e/0fd2937a105449e4ac03e37d5083ea96?itemPath=/tmp/exported-text.xml" -F "format=xml" -F "tenantId=<tenantId>"
0 Kudos
Highlighted
Linear Actuator

@bstephens
Thanks a lot.
I used below command given by you and was able to get the dataset data displayed.

1)
curl -sS -f -u ":<REST_TOKEN>" -X POST "http://<paxata_host>/rest/datasource/exports/local/aadd13cf65744606ad5842f1b7a22767?pretty=true" -F "format=separator" -F "tenantId=<tenantId>"

Above command displayed output in git bash window.

 

2)

Export a datafile in XML format to the file /tmp/exported-text.xml a connected data source:

curl -sS -f -u ":<REST_TOKEN>" -X POST "https://<paxata_host>/rest/datasource/exports/2da34c162ed8439aa404ba1abfe7e33e/0fd2937a105449e4ac03e37d5083ea96?itemPath=/tmp/exported-text.xml" -F "format=xml" -F "tenantId=<tenantId>"

Above command threw error as "The requested URL returned error: 403 FATAL: You do not have the required permissions: ExportDataSource"

Can you please guide which permission we need to take for exporting?

Regards,
Abhijeet

0 Kudos
Highlighted
Linear Actuator
@abhijeetmkhambe
I assume that you substituted the placeholder values (<REST_TOKEN>, <paxata_host> and <tenantId>) with your actual values?
0 Kudos
Highlighted
Linear Actuator
@bstephens
Yes. I did.
0 Kudos
Linear Actuator

@abhijeetmkhambe 

Here is a more complete version. I didn't clearly indicate that you need to use your dataSourceId, dataFileId and ExportItemPath:

curl -sS -f -u ":<REST_TOKEN>" -X POST "https://<paxata_host>/rest/datasource/exports/<dataSourceId>/<dataFileId>?itemPath=<exportItemPath>" -F "format=xml" -F "tenantId=<tenantId>"



"The requested URL returned error: 403 FATAL: You do not have the required permissions: ExportDataSource"
The account that you are using does not have the necessary permission to perform and export of the datafile

  • Your account needs to be in the a Role that includes the Library->Export Dataset permission. This permission is granted on the Paxata Administration. Your administrator may need to handle this request. 
  • You also need permission to Download the specific dataset. The dataset owner will need to provide this permission. 
0 Kudos
Highlighted
Linear Actuator
@bstephens
We already have EXPORT permission given by paxata administrator.
0 Kudos
Highlighted
Linear Actuator

@bstephens

Below syntax worked correctly and xml file was saved at location specified with all the data from dataset.

 

curl -sS -f -u ":<REST_TOKEN>" -X POST "http://<paxata_host>/rest/datasource/exports/local/aadd13cf65744606ad5842f1b7a22767?format=xml">C:/Users/PP66525/Documents/foo.xml

We specified path directly without itemPath and it worked. This is ok for lower region.

 

But actually we want to specify specific path of a shared drive from where other application will pick up the dataset/asnwerset. So, what needs to be done for this?

 

Regards,

Abhijeet

0 Kudos