You probably have an issue with XML. Validate your config to make sure it's a valid XML file.
Update, I tried curl so I can confirm the api works at the clicksend end (the endpoint they give in the docs is rubbish :-) )
Here is my curl:
curl https://rest.clicksend.com/v3/sms/send -u "xxxxxxxxx@gmail.com:8A705B70-XXXXXXXXXXXXXXXXXX" --request POST --header "Content-Type: application/json" --data-binary "{\"messages\":[{\"source\":\"php\",\"body\":\"This is a test subject\",\"to\":\"+44XXXXXXXXX\"}]}"
When I issue this I get the message. I think I am in error in my config.
Can someone review my config?
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<entry key='config.default'>./conf/default.xml</entry>
<!--
This is the main configuration file. All your configuration parameters should be placed in this file.
Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
remove "config.default" parameter from this file unless you know what you are doing.
For list of available parameters see following page: https://www.traccar.org/configuration-file/
-->
<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./data/database</entry>
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>
<entry key='notificator.types'>web,mail,sms</entry>
<entry key='sms.http.url'>https://rest.clicksend.com/v3</entry>
<entry key='sms.http.user'>xxxxxxxxx@gmail.com</entry>
<entry key='sms.http.password'>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</entry>
<entry key='sms.http.template'>
{
"messages": [
{
"source": "Traccar",
"body": "{message}",
"to": "{phone}"
}
]
}
</properties>
Your config is missing </entry>
.
I have attached my config above, it looks cool to me?
And that sir is why you are so smart, thank you and BTW thank you for the app and all the work you put into it.
The address in the documentation is now outdated the endpoint I used above works.
So my curl command works:
curl https://rest.clicksend.com/v3/sms/send -u "xxxxxxxxx@gmail.com:8A705B70-XXXXXXXXXXXXXXXXXX" --request POST --header "Content-Type: application/json" --data-binary "{\"messages\":[{\"source\":\"php\",\"body\":\"This is a test subject\",\"to\":\"+44XXXXXXXXX\"}]}"
but my config file, which I think is right:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<entry key='config.default'>./conf/default.xml</entry>
<!--
This is the main configuration file. All your configuration parameters should be placed in this file.
Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
remove "config.default" parameter from this file unless you know what you are doing.
For list of available parameters see following page: https://www.traccar.org/configuration-file/
-->
<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./data/database</entry>
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>
<entry key='notificator.types'>web,mail,sms</entry>
<entry key='sms.http.url'>https://rest.clicksend.com/v3/sms/send</entry>
<entry key='sms.http.user'>xxxxxxxxxx@gmail.com</entry>
<entry key='sms.http.password'>8A705B70-D4CXXXXXXXXXXXXXXXXXXXXX</entry>
<entry key='sms.http.template'>
{
"messages": [
{
"source": "Traccar",
"body": "{message}",
"to": "{phone}"
}
]
}
</entry>
</properties>
Does not complain when I send, I get no error message or entry in the log but I get no sms message through, did I miss something?
If you don't get any errors, it means that the API call was made successfully.
Is there a way I can print the request? I am wondering if it is sending to the right number. My device settings are :
Name Identifier Group Phone Model Contact Expiration
Gus Phone 683XXX Samsung Fold 4 +44XXXXXXXXXXX
It will send SMS to the phone field.
Ah thats it I thought it was the contact field. Grat stuff works great now. For the documentation change the endpoint to be https://rest.clicksend.com/v3/sms/send and it will help other folks.
I am starting out using CURL to test the API. The address that I get a response from for clicksend is https://rest.clicksend.com/v3. Am I right, I include these lines into my config file:
When I include these lines in config the server fails to start and I get nothing in the logfile. Can anyone help?