I am new to Haystack platform , My query is : how to Integrate to Haystack Connection through using "REST API" . Please provide me the details/Example, so i can understand & use this platform.
I have gone through the detail documentation but one of the link of Rest API page (https://project-haystack.org/doc/Rest) is not getting open. It gives 404 not Found error.
Please Guide me regarding the same.
Thanks & Regards Gaurav Sahu
Chris BreederveldSat 8 May 2021
Hi Gaurav,
I think that link should now point to this location because things have moved around a bit with the new docs setup.
GAURAV SAHUMon 14 Jun 2021
Hi Chris Breederveld,
I am new to this "Haystack" integration ,i have read and also gone through the docs, details & Example of Skyfoundry "https://github.com/skyfoundry/haystack-java" , i am phasing some complication to understand and about how to connect & Use the Haystack Tagging/features to the project. I need your help to understand that how could i use it and can you please provide me some demo videos in Java platform through REST API , So i can able to understand the structure that how it is Connecting , working and how can apply tagging to the projects.
Thanks & Regards Gaurav Sahu
Chris BreederveldMon 14 Jun 2021
HI Gaurav,
It is a bit hard for me to gauge your level of knowledge and where you need help exactly, but I'll try to give you some general pointers and then perhaps you can give me a bit more detail what topics you are exactly struggling with. Also I would like to know which Haystack server you are working with, this might also help with providing more specific resources.
Haystack ontology
To get some overall insight about the tagging mechanism in Haystack I can recommend this video which explains the current v4 standard (under review at the time of this video): https://www.youtube.com/watch?v=5kZZW1HCMwA
Haystack API authentication
It depends a bit what system you are connecting to, but most implementations use the SCRAM authentication method, all described in this documentation. In the Java library you can set up such a connection using this code:
HClient client = HClient.open("http://localhost/api/demo", "user", "pass");
client.about(); // <- gets some basic info, useful to test your connection.
Haystack operations
The Java client has functions like pointWrite to write records and hisRead to read historic information. You can use filters like point and equipRef->elec in function onReadAll to get a list of filtered items.
HGrid grid = client.onReadAll("point and equipRef->elec");
for (int i = 0; i < grid.numRows(); i++) {
HRow row = grid.row(i);
...
}
GAURAV SAHUTue 15 Jun 2021
HI ,
Can we directly import & run this example project given "https://github.com/skyfoundry/haystack-java" code for basic understanding in tomcat server to see how its workflow structure???
Thanks & Regards Gaurav Sahu
GAURAV SAHUWed 30 Jun 2021
HI Chris,
I am facing 501 error code while using the the javacode in example"https://github.com/skyfoundry/haystack-java", under "HClient.java" It ask (user name ,password and URL) , can you please help me on this?
Thanks &Regards Gaurav Sahu
Chris BreederveldWed 30 Jun 2021
Hi Gaurav,
Again I would love to know what Haystack server you are working with? NHaystack? SkySpark?
Usually the URL should be of the form "https://some-domain/api/" (don't forget the trailing slash) and the user/pass are just the plaintext credentials you use to log into the application.
GAURAV SAHUWed 30 Jun 2021
Hi Chris,
we are working with SkySpark &we are passing the argument ("url,user,password) of skypark credential but it gives this below error with 501 (not Implemented ). and one more query regard (HClient.java) file havemn't found the implementation method. Please help me with this Issue.
Exception in thread "main" org.projecthaystack.client.CallNetworkException: org.projecthaystack.client.CallHttpException: 501: Not Implemented
at org.projecthaystack.client.HClient.postString(HClient.java:651)
at org.projecthaystack.client.HClient.postString(HClient.java:611)
at org.projecthaystack.client.HClient.postGrid(HClient.java:605)
at org.projecthaystack.client.HClient.call(HClient.java:597)
at org.projecthaystack.client.HClient.about(HClient.java:184)
at org.projecthaystack.client.HClient.main(HClient.java:770)
Caused by: org.projecthaystack.client.CallHttpException: 501: Not Implemented
at org.projecthaystack.client.HClient.postString(HClient.java:637)
... 5 more
Thanks & Regards Gaurav Sahu
Chris BreederveldWed 30 Jun 2021
Hi Gaurav,
In SkySpark you will also need to include the project in the URI after /api/. Can you try this code and see what you get?
The "sys" project is a special project in SkySpark that is always available, but has limited functionality, you can also replace this later with your specific project name.
GAURAV SAHUWed 30 Jun 2021
Hi Chris,
Thanks Chris ,after connecting the URI with sys default functionality " <server uri> /api/sys" it is hitting the sys function.
"Is There any other functionality other than sys to connect?"
Thanks & Regards Gaurav Sahu
Chris BreederveldWed 30 Jun 2021
Ok, well now all you need to do is replace "sys" with the project name in SkySpark, for example "demo". Then you can use the other calls to get data, for example:
For any subsequent implementation questions on how to do certain operations or get data, I would suggest to have a look at the SkySpark forum. There are more examples there and more specific SkySpark operations that are not part of the Haystack library.
Yali RothenbergMon 19 Jun 2023
Hi, is there a way to edit the headers (for content negotiation) using the api without the servlet in java?
GAURAV SAHU Fri 7 May 2021
Hi ,
I am new to Haystack platform , My query is : how to Integrate to Haystack Connection through using "REST API" . Please provide me the details/Example, so i can understand & use this platform.
Thanks & Regards Gaurav Sahu
Chris Breederveld Fri 7 May 2021
Hi Gaurav,
You may want to look into the haystack-java library, and take a look at the detailed documentation
GAURAV SAHU Sat 8 May 2021
Hi Chris Breederveld,
I have gone through the detail documentation but one of the link of Rest API page (https://project-haystack.org/doc/Rest) is not getting open. It gives 404 not Found error.
Please Guide me regarding the same.
Thanks & Regards Gaurav Sahu
Chris Breederveld Sat 8 May 2021
Hi Gaurav,
I think that link should now point to this location because things have moved around a bit with the new docs setup.
GAURAV SAHU Mon 14 Jun 2021
Hi Chris Breederveld,
I am new to this "Haystack" integration ,i have read and also gone through the docs, details & Example of Skyfoundry "https://github.com/skyfoundry/haystack-java" , i am phasing some complication to understand and about how to connect & Use the Haystack Tagging/features to the project. I need your help to understand that how could i use it and can you please provide me some demo videos in Java platform through REST API , So i can able to understand the structure that how it is Connecting , working and how can apply tagging to the projects.
Thanks & Regards Gaurav Sahu
Chris Breederveld Mon 14 Jun 2021
HI Gaurav,
It is a bit hard for me to gauge your level of knowledge and where you need help exactly, but I'll try to give you some general pointers and then perhaps you can give me a bit more detail what topics you are exactly struggling with. Also I would like to know which Haystack server you are working with, this might also help with providing more specific resources.
Haystack ontology
To get some overall insight about the tagging mechanism in Haystack I can recommend this video which explains the current v4 standard (under review at the time of this video): https://www.youtube.com/watch?v=5kZZW1HCMwA
Haystack API authentication
It depends a bit what system you are connecting to, but most implementations use the SCRAM authentication method, all described in this documentation. In the Java library you can set up such a connection using this code:
Haystack operations
The Java client has functions like
pointWrite
to write records andhisRead
to read historic information. You can use filters likepoint and equipRef->elec
in functiononReadAll
to get a list of filtered items.GAURAV SAHU Tue 15 Jun 2021
HI ,
Can we directly import & run this example project given "https://github.com/skyfoundry/haystack-java" code for basic understanding in tomcat server to see how its workflow structure???
Thanks & Regards Gaurav Sahu
GAURAV SAHU Wed 30 Jun 2021
HI Chris,
I am facing 501 error code while using the the javacode in example"https://github.com/skyfoundry/haystack-java", under "HClient.java" It ask (user name ,password and URL) , can you please help me on this?
Thanks &Regards Gaurav Sahu
Chris Breederveld Wed 30 Jun 2021
Hi Gaurav,
Again I would love to know what Haystack server you are working with? NHaystack? SkySpark?
Usually the URL should be of the form "https://some-domain/api/" (don't forget the trailing slash) and the user/pass are just the plaintext credentials you use to log into the application.
GAURAV SAHU Wed 30 Jun 2021
Hi Chris,
we are working with SkySpark &we are passing the argument ("url,user,password) of skypark credential but it gives this below error with 501 (not Implemented ). and one more query regard (HClient.java) file havemn't found the implementation method. Please help me with this Issue.
Exception in thread "main" org.projecthaystack.client.CallNetworkException: org.projecthaystack.client.CallHttpException: 501: Not Implemented
Caused by: org.projecthaystack.client.CallHttpException: 501: Not Implemented
Thanks & Regards Gaurav Sahu
Chris Breederveld Wed 30 Jun 2021
Hi Gaurav,
In SkySpark you will also need to include the project in the URI after /api/. Can you try this code and see what you get?
The "sys" project is a special project in SkySpark that is always available, but has limited functionality, you can also replace this later with your specific project name.
GAURAV SAHU Wed 30 Jun 2021
Hi Chris,
Thanks Chris ,after connecting the URI with sys default functionality " <server uri> /api/sys" it is hitting the sys function.
Thanks & Regards Gaurav Sahu
Chris Breederveld Wed 30 Jun 2021
Ok, well now all you need to do is replace "sys" with the project name in SkySpark, for example "demo". Then you can use the other calls to get data, for example:
HGrid sites = client.readAll("site")
Chris Breederveld Wed 30 Jun 2021
For any subsequent implementation questions on how to do certain operations or get data, I would suggest to have a look at the SkySpark forum. There are more examples there and more specific SkySpark operations that are not part of the Haystack library.
Yali Rothenberg Mon 19 Jun 2023
Hi, is there a way to edit the headers (for content negotiation) using the api without the servlet in java?