FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
08-20-2024 07:18 AM
Hi everyone,
to get some device specific parameters we want to use the EtherCat Master API directly.
Using HTTPS and the IP address of the ctrlX CORE everything works as expected.
Is there a way to request data form the EtherCat Master API using Unix Sockets such as the license API?
(So that there is no need for HTTPS and a valid bearer token)
Can anybody provide an example which plug is required and what's the correct path to the socket file?
Thanks in advance.
Regards,
Fabian
Solved! Go to Solution.
08-20-2024 08:26 AM
The datalayer SDK uses IPC when running locally and TCP when running remotly:
// Builds the connection string: 'ipc' if running inside a snap, otherwise 'tcp'.
func (cb *Remote) Build() string {
if os.Getenv("SNAP") != "" {
return "ipc://"
}
return "tcp://" + cb.user + ":" + cb.password + "@" + cb.ip + "?sslport=" + strconv.Itoa(cb.sslPort)
}
So if you build an snap that runs in the core its better to use this then the rest API.
08-20-2024 09:59 AM
Hello,
You have to options:
- keep your code and use Service-2-service auth in order to get a valid token withaout a user in the app 🙂
- Do as @AndreasL suggested and use the SDK libs
08-21-2024 07:26 AM
Thanks for pointing me in the right direction.
To request the data via the Data Layer directly seems to be the right way.