Giter VIP home page Giter VIP logo

java-api's Introduction

Agile CRM Java API

Agile CRM is a new breed CRM software with sales and marketing automation.

Table of contents

Requirements

Installation

Reference

Usage

Video Example using Java

Requirements

  1. Java 1.5 and later.

  2. Setting Domain Name and Api Key

Finding Domain name, email and api key

In the above image, api key is present at the "Api & Analytics" tab at https://mycompany.agilecrm.com/#account-prefs.

So you have to update your https://github.com/agilecrm/java-api/blob/master/AgileCRMJavaAPI/src/com/test/TestAgile.java

    String baseUrl = "https://{domain}.agilecrm.com/dev";
    String userEmail = "your_user_email";
    String restAPIKey = "***************************";

    // Create a connection to Agile CRM

Installation

Installation

We have all jars required for testing code in Lib folder. You can manually download the following JARs or latest version compatible with each other:

  • jersey-client-1.9.jar
  • jersey-core-1.9.jar
  • jersey-json-1.9.jar
  • jackson-core-asl-1.9.2.jar
  • jackson-mapper-asl-1.9.2.jar
  • json.jar

Usage

TestAgile.java

package com.test;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONObject;

import com.agilecrm.api.APIManager;
import com.agilecrm.api.ContactAPI;
import com.agilecrm.stubs.Contact;
import com.agilecrm.stubs.Contact.Type;
package com.test;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONObject;

import com.agilecrm.api.APIManager;
import com.agilecrm.api.ContactAPI;
import com.agilecrm.stubs.Contact;
import com.agilecrm.stubs.Contact.Type;
import com.agilecrm.stubs.ContactField.FieldName;

public class TestAgile {
    public static void main(String[] args) {
	try {
	    String baseUrl = "https://{your_domain}.agilecrm.com/dev";
	    String userEmail = "ghanshyam@.....";
	    String restAPIKey = "your_rest_key";

	    // Create a connection to Agile CRM
	    APIManager apiManager = new APIManager(baseUrl, userEmail,
		    restAPIKey);

	    // Get the Contact API with configured resource
	    ContactAPI contactApi = apiManager.getContactAPI();

	    // ------------------- Adding a person ----------------------------
	    Contact person1 = new Contact();

	    person1.setType(Type.PERSON);
	    person1.setLead_score(3);
	    person1.setContactField(FieldName.FIRST_NAME, "Annie");
	    person1.setContactField(FieldName.LAST_NAME, "Besant");
	    person1.setContactField(FieldName.ORGANIZATION,
		    "London School Board");
	    person1.setContactField(FieldName.EMAIL, "[email protected]");
	    person1.setContactField(FieldName.TITLE, "socialist");
	    person1.setContactField(FieldName.PHONE, "+48624981");
	    person1.setContactField(FieldName.WEBSITE,
		    "http://agile-crm-cloud.appspot.com");
	    JSONObject address = new JSONObject();
	    address.put("city", "Clapham");
	    address.put("state", "London");
	    address.put("country", "United Kingdom");
	    person1.setContactField(FieldName.ADDRESS, address.toString());

	    person1.setCustomField("Date Of Joining", "Test Add Custom Field");

	    // List of tags to add it to contact
	    List<String> tags;

	    tags = new ArrayList<String>();
	    tags.add("developer");
	    tags.add("subscribe");
	    tags.add("connection");
	    person1.setTags(tags);

	    // person1 = contactApi.addContact(person1);

	    // Update a contact
	    // ------------------- Update Contact properties
	    // ---------------------
	    String contactDeailJson = "{\"id\":5745111329669120, "
		    + "\"properties\":["
		    + " {\"type\":\"SYSTEM\", \"name\":\"first_name\", \"value\":\"Jason\"}, "
		    + " {\"type\":\"SYSTEM\", \"name\":\"address\", \"value\":'{\"address\":\"225 George Street\",\"city\":\"NSW\",\"state\":\"Sydney\",\"zip\":\"2000\",\"country\":\"Australia\"}'},"
		    + "{\"type\":\"CUSTOM\", \"name\":\"My custom field of type date\", \"value\":\"1481871525\"}]}";

	    contactApi.updateContactPartialUpdate(contactDeailJson);

	    // ---------Get contacts by filter field------------------
	    // pass type of filter,filter value,page_size,cursor
	    // contactApi.getContactsByDynamicFilter("tags","Lead","5","first_page");

	    // Get list of contacts based on page size and cursor
	    // contactApi.getContacts("10","first_page");

	} catch (Exception e) {
	    System.out.println("Exception message.. " + e.getMessage());
	    e.printStackTrace();
	}
    }
}

See TestContact.java for more examples.

Reference

See Agile CRM Rest API for more information.

###Create contact:

IMAGE ALT TEXT HERE

java-api's People

Contributors

graut avatar tejaswiplugins avatar karthikagile avatar ranjanagilecrm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.