LookupsLib

Java SDK for MessageMedia Lookups API

License

License

GroupId

GroupId

com.messagemedia.sdk
ArtifactId

ArtifactId

lookups
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

LookupsLib
Java SDK for MessageMedia Lookups API
Project URL

Project URL

https://github.com/messagemedia/lookups-java-sdk
Source Code Management

Source Code Management

https://github.com/messagemedia/lookups-java-sdk

Download lookups

How to add to project

<!-- https://jarcasting.com/artifacts/com.messagemedia.sdk/lookups/ -->
<dependency>
    <groupId>com.messagemedia.sdk</groupId>
    <artifactId>lookups</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.messagemedia.sdk/lookups/
implementation 'com.messagemedia.sdk:lookups:2.0.1'
// https://jarcasting.com/artifacts/com.messagemedia.sdk/lookups/
implementation ("com.messagemedia.sdk:lookups:2.0.1")
'com.messagemedia.sdk:lookups:jar:2.0.1'
<dependency org="com.messagemedia.sdk" name="lookups" rev="2.0.1">
  <artifact name="lookups" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.messagemedia.sdk', module='lookups', version='2.0.1')
)
libraryDependencies += "com.messagemedia.sdk" % "lookups" % "2.0.1"
[com.messagemedia.sdk/lookups "2.0.1"]

Dependencies

compile (9)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 3.10.0
com.fasterxml.jackson.core : jackson-databind jar 2.9.8
com.fasterxml.jackson.core : jackson-core jar 2.9.8
com.fasterxml.jackson.core : jackson-annotations jar 2.9.8
org.apache.httpcomponents : httpasyncclient jar 4.0.1
org.apache.httpcomponents : httpclient jar 4.4.1
org.apache.httpcomponents : httpcore jar 4.4.1
org.apache.httpcomponents : httpmime jar 4.3.4
org.apache.httpcomponents : httpcore-nio jar 4.3.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

MessageMedia Lookups Java SDK

Travis Build Status Pull Requests Welcome maven

The MessageMedia Lookups API provides a number of endpoints for validating the phone numbers you’re sending to by checking their validity, type and carrier records.

Isometric

Table of Contents

πŸ” Authentication

Authentication is done via API keys. Sign up at https://developers.messagemedia.com/register/ to get your API keys.

Requests are authenticated using HTTP Basic Auth or HMAC. Provide your API key as the auth_user_name and API secret as the auth_password.

⁉️ Errors

Our API returns standard HTTP success or error status codes. For errors, we will also include extra information about what went wrong encoded in the response as JSON. The most common status codes are listed below.

HTTP Status Codes

Code Title Description
400 Invalid Request The request was invalid
401 Unauthorized Your API credentials are invalid
403 Disabled feature Feature not enabled
404 Not Found The resource does not exist
50X Internal Server Error An error occurred with our API

πŸ“° Information

Slack and Mailing List

If you have any questions, comments, or concerns, please join our Slack channel: https://developers.messagemedia.com/collaborate/slack/

Alternatively you can email us at: [email protected]

Bug reports

If you discover a problem with the SDK, we would like to know about it. You can raise an issue or send an email to: [email protected]

Contributing

We welcome your thoughts on how we could best provide you with SDKs that would simplify how you consume our services in your application. You can fork and create pull requests for any features you would like to see or raise an issue

⭐ Installation

At present the jars are available from a public maven repository.

Use the following dependency in your project to grab via Maven:

<dependency>
    <groupId>com.messagemedia.sdk</groupId>
    <artifactId>lookups</artifactId>
    <version>2.0.0</version>
</dependency>

🎬 Get Started

It's easy to get started. Simply enter the API Key and secret you obtained from the MessageMedia Developers Portal into the code snippet below and a mobile number you wish to send to.

Lookup a number

package lookupstest.lookupstest;

import com.messagemedia.api.LookupsClient;
import com.messagemedia.api.controllers.LookupsController;
import com.messagemedia.api.http.client.APICallBack;
import com.messagemedia.api.http.client.HttpContext;
import com.messagemedia.api.models.LookupAPhoneNumberResponse;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );

        String authUserName = "API_KEY"; // The username to use with authentication
        String authPassword = "API_SECRET"; // The password to use with authentication
        Boolean hmac = false; //set to true if using HMAC authentication

        LookupsClient client = new LookupsClient(authUserName, authPassword, false);
        LookupsController lookups = client.getLookups();

        String phoneNumber = "+614<NUMBER>";
        String options = "carrier,type";
        // Invoking the API call with sample inputs

        lookups.getLookupAPhoneNumberAsync(phoneNumber, options, new APICallBack<LookupAPhoneNumberResponse>() {

            public void onSuccess(HttpContext context, LookupAPhoneNumberResponse response) {
                // TODO success callback handler


            	System.out.println(response.getCarrier().getName());

            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler

            	System.out.println("error " + error.getMessage());
            }
        });

    }
}

Lookup hlr

package lookupstest.lookupstest;

import com.messagemedia.api.LookupsClient;
import com.messagemedia.api.controllers.LookupsController;
import com.messagemedia.api.http.client.APICallBack;
import com.messagemedia.api.http.client.HttpContext;
import com.messagemedia.api.models.LookupAPhoneNumberResponse;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );

        String authUserName = "API_KEY"; // The username to use with authentication
        String authPassword = "API_SECRET"; // The password to use with authentication
        Boolean hmac = false; //set to true if using HMAC authentication

        LookupsClient client = new LookupsClient(authUserName, authPassword, false);
        LookupsController lookups = client.getLookups();

        String phoneNumber = "+614<NUMBER>";
        String options = "hlr";
        // Invoking the API call with sample inputs

        lookups.getLookupAPhoneNumberAsync(phoneNumber, options, new APICallBack<LookupAPhoneNumberResponse>() {

            public void onSuccess(HttpContext context, LookupAPhoneNumberResponse response) {
                // TODO success callback handler


            	System.out.println(response.getImsi());

            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler

            	System.out.println("error " + error.getMessage());
            }
        });

    }
}

πŸ“• API Reference Documentation

Check out the full API documentation for more detailed information.

πŸ˜• Need help?

Please contact developer support at [email protected] or check out the developer portal at developers.messagemedia.com

πŸ“ƒ License

Apache License. See the LICENSE file.

com.messagemedia.sdk

MessageMedia

Business SMS messaging. And so much more.

Versions

Version
2.0.1
2.0.0
1.0.0