cancel
Showing results for 
Search instead for 
Did you mean: 

Paxata project creation with available dataset through a Java Program

Paxata project creation with available dataset through a Java Program

Hi,
Can someone please let me know if it is possible to create a project in paxata which will pull the existing dataset information in it through a Java code.
Currently, I was able to create a blank project in paxata using java code. But my requirement is, while project creation it should also pull the existing dataset information in it.

Regards,
Abhijeet
Labels (1)
19 Replies

Thanks Melanie.

I have one more query.
As per the documentation of paxata, GET calls for REST token are not supported. So while doing POST call through Java code, are we supposed to create new token every time?

Also, syntax for token generation is as below
curl -sS -f -u "superuser:superuser" "http://localhost:8080/rest/tokens" -X POST

I believe superuser:superuser means userid:password for paxata system for a user.
So, i provided my paxata url credentials there and it did not generate a new token. 
I had to provide old token at the place of superuser:superuser.
Can you please guide.


Regards,
Abhijeet

curl -sS -f -u ":token" "http://localhost:8080/rest/tokens" -X POST 

this is the syntax when you prefer to use a token. I hope this helps!

Thank You,
Akshay

Hi Akshay,
I understood the syntax and was able to figure it out earlier as well. But to generate a new token, we first need to be aware of previous token. But as per documentation, GET calls to retrieve token are not supported. So, are we supposed to save the token somewhere in database and retrieve from there or paxata internally stores token in some internal table. Can you please guide.


Regards,
Abhijeet

@abhijeetmkhambe

Yes, you need to remember your REST API Token. 

Your best approach to obtaining a Token is to use a PUT:  
  • The server first deletes any existing authentication tokens for the current user, if such tokens exist. 

  • The server creates a new token, and returns the new token as the result.

Thanks,
Bill

@bstephens  
Thanks.

One more query if someone can answer.

The way we can get single or all project details using REST API, is there any REST API which can list a single dataset as well as all datasets currently created in the system?

Regards,
Abhijeet

@abhijeetmkhambe

It's unclear what you mean by "get details" or "list a dataset" I'm answering based on the assumption that you're obtaining metadata about Projects ad Datafiles:

Library Datafile metadata: use the /library/data API
      Response source.type will inform you of the file type
  • File = Imported via local upload
  • Connector: Imported from a Connector
  • Script: An AnswerSet generated from a Paxata Project
FYI: If you want a simple result set of tab separated fields containing a subset of fields, use the "return" option. Here, I get one delimited row of results per dataset containing only the 5 specified fields. 
Thanks,
Bill

@bstephens,
Thanks for the answer. But, if we execute above urls through httpclient, we will get an httpresponse as output. Can paxata return me the metadata of all datasets in json format as output.

@bstephens
Thanks. we are able to retrieve all datasets programmatically using the api syntax you provided.

One more query we have ---> We want to fulfill a scenario where rather than creating a new dataset every time when we fire a query through my java code, we just want to update the dataset version. Is it achievable?

Regards,
Abhijeet

@abhijeetmkhambe

To create a new version of an existing dataset, you'll perform a PUT against the /datasource/imports/ Endpoint. 

New version of dataset using Local Upload: 
New version of dataset uploaded using a configured datasource:
  • https://example.paxata.com/rest/datasource/imports/<dataSourceID>/<datafileId>
Thanks,
Bill

@bstephens
Thanks. I will try with the syntax you provided.

Regards,
Abhijeet