https://github.com/moceanapi/mocean-sdk-java
✉📲 SDK Library for Java to send SMS for FREE using MoceanAPI sms solution.
https://github.com/moceanapi/mocean-sdk-java
java moceanapi sms sms-api sms-client sms-messages
Last synced: 4 months ago
JSON representation
✉📲 SDK Library for Java to send SMS for FREE using MoceanAPI sms solution.
- Host: GitHub
- URL: https://github.com/moceanapi/mocean-sdk-java
- Owner: MoceanAPI
- License: mit
- Created: 2018-07-04T06:49:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-26T04:13:20.000Z (about 2 years ago)
- Last Synced: 2025-07-07T08:11:50.677Z (6 months ago)
- Topics: java, moceanapi, sms, sms-api, sms-client, sms-messages
- Language: Java
- Homepage: https://moceanapi.com/
- Size: 238 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
MoceanAPI Client Library for Java
============================
[](https://mvnrepository.com/artifact/com.github.moceanapi/moceanapisdk)
[](https://github.com/MoceanAPI/mocean-sdk-java/actions/workflows/build.yml)
[](https://codecov.io/gh/MoceanAPI/mocean-sdk-java)
[](https://app.codacy.com/project/MoceanAPI/mocean-sdk-java/dashboard)
[](https://www.npmjs.com/package/mocean-sdk)
This is the Java client library for use Mocean's API. To use this, you'll need a Mocean account. Sign up [for free at
moceanapi.com][signup].
* [Installation](#installation)
* [Usage](#usage)
* [Example](#example)
## Installation
To use the client library you'll need to have [created a Mocean account][signup].
### Maven
Add the following to the correct place in your project's POM file:
```xml
com.github.moceanapi
moceanapisdk
1.x.x
```
### Gradle
Add the following to `build.gradle`
```groovy
repositories {
mavenCentral()
}
```
For Gradle 3.4 or Higher:
```groovy
dependencies {
implementation 'com.github.moceanapi:moceanapisdk:1.x.x'
}
```
For older versions:
```groovy
dependencies {
compile 'com.github.moceanapi:moceanapisdk:1.x.x'
}
```
## Usage
Create a client with your API key and secret:
```java
import com.mocean.system.Mocean;
import com.mocean.system.auth.Basic;
Basic credential = new Basic("API_KEY_HERE","API_SECRET_HERE");
Mocean mocean = new Mocean(credential);
```
## Example
To use [Mocean's SMS API][doc_sms] to send an SMS message, call the `mocean.sms.send()` method.
The API can be called directly, using a simple array of parameters, the keys match the [parameters of the API][doc_sms].
```java
SmsResponse res = mocean.sms()
.setFrom("MOCEAN")
.setTo("60123456789")
.setText("Hello World")
.send();
System.out.println(res);
```
### Responses
For your convenient, the API response has been parse to specified object.
```java
System.out.println(res); //show full response string
System.out.println(res.status); //show response status, "0" in this case
```
## Documentation
Kindly visit [MoceanApi Docs][doc_main] for more usage
License
-------
This library is released under the [MIT License][license]
[signup]: https://dashboard.moceanapi.com/register?medium=github&campaign=java-sdk
[doc_main]: https://moceanapi.com/docs/?java
[doc_sms]: https://moceanapi.com/docs/?java#send-sms
[license]: LICENSE.txt