rest-api-client

Java client(Android friendly) for CRUD operations on REST APIs

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.itzmedinesh
ArtifactId

ArtifactId

rest-api-client
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom
Description

Description

rest-api-client
Java client(Android friendly) for CRUD operations on REST APIs
Project URL

Project URL

https://github.com/itzmedinesh/rest-api-client.git
Source Code Management

Source Code Management

https://github.com/itzmedinesh/rest-api-client

Download rest-api-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.itzmedinesh/rest-api-client/ -->
<dependency>
    <groupId>com.github.itzmedinesh</groupId>
    <artifactId>rest-api-client</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.itzmedinesh/rest-api-client/
implementation 'com.github.itzmedinesh:rest-api-client:1.0.0'
// https://jarcasting.com/artifacts/com.github.itzmedinesh/rest-api-client/
implementation ("com.github.itzmedinesh:rest-api-client:1.0.0")
'com.github.itzmedinesh:rest-api-client:pom:1.0.0'
<dependency org="com.github.itzmedinesh" name="rest-api-client" rev="1.0.0">
  <artifact name="rest-api-client" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.itzmedinesh', module='rest-api-client', version='1.0.0')
)
libraryDependencies += "com.github.itzmedinesh" % "rest-api-client" % "1.0.0"
[com.github.itzmedinesh/rest-api-client "1.0.0"]

Dependencies

compile (9)

Group / Artifact Type Version
javax.ws.rs : javax.ws.rs-api jar 2.0.1
org.slf4j : slf4j-api jar 1.7.12
log4j : log4j jar 1.2.17
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar 2.6.3
com.fasterxml.jackson.core : jackson-databind jar 2.6.3
org.glassfish.jersey.connectors : jersey-apache-connector jar 2.22.1
org.glassfish.jersey.core : jersey-client jar 2.22.1
org.apache.commons : commons-lang3 jar 3.4
org.glassfish.jersey.security : oauth2-client jar 2.25

Project Modules

There are no modules declared in this project.

RestApiClient

Java client(Android friendly) for CRUD operations on REST API.

Versions on maven

http://central.maven.org/maven2/com/github/itzmedinesh/rest-api-client/

Sample YAML configuration


service.url:
  TEST_URL_CONFIG_1:
    url.hostname: xxxxxxxxx.test.com
    url.ssl.enabled: false
    url.port: 80
    url.resource.path: /direct/rest/price/
    url.proxy:
      proxy.url: http://proxy.com
      proxy.username: test
      proxy.password: test
    url.query.params:
      format: standard
    url.path.params:
      sku.key: sku
    url.properties:
      url.query.limit: 5
  TEST_URL_CONFIG_2:
    url.hostname: xxxxx.com
    url.ssl.enabled: true
    url.port: 443
    url.resource.path: /apis/v1.0/
    url.path.params:
      apiId: 45c9bbb23584
      key: Shortname 

Initialization of rest clients and accessing REST API


private static final int CONNECT_TIMEOUT = 3000;
private static final int READ_TIMEOUT = 3000;

ClientTemplate<Response> restRetrieveTemplate = new RestServiceClient(CONNECT_TIMEOUT,READ_TIMEOUT).createClientTemplate(
								"TEST_URL_CONFIG_2",
								configuration.getServiceUrlConfig().get(
										"TEST_URL_CONFIG_2"));
										
Map<String, String> queryParams = new LinkedHashMap<String, String>();
pathParams.put("clientId", "test");

Map<String, String> pathParams = new LinkedHashMap<String, String>();
pathParams.put("value", "dinesh");										
										
Response response = restRetrieveTemplate.retrieve(queryParams, pathParams);	


For Android Apps

ClientTemplate<Response> restRetrieveTemplate = new AndroidRestServiceClient(CONNECT_TIMEOUT,READ_TIMEOUT).createClientTemplate(
								"TEST_URL_CONFIG_2",
								configuration.getServiceUrlConfig().get(
										"TEST_URL_CONFIG_2"));									

Versions

Version
1.0.0