Code Monkey home page Code Monkey logo

nodejs's Issues

HTTP400 on function getDealByContactId

if i call the function getDealByContactId, the function respond with following error:

Status Code = 400
SyntaxError: Unexpected token < in JSON at position 0
    at Object.parse (native)
    at IncomingMessage.<anonymous> (/Users/Tilman/Documents/Programme/NodeJS/async_test/node_modules/agile_crm/agilecrm.js:477:48)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Status code 400 and following body (got it with debuging features) idicate, the API is calling the wrong api endpoint.

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>400 Unable to extract parameter from http request: javax.ws.rs.PathParam("contact-id") value is '5137069722566656deals' for public com.agilecrm.contact.Contact com.agilecrm.core.api.contacts.ContactsAPI.getContact(java.lang.Long) throws com.agilecrm.user.access.exception.AccessDeniedException</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Unable to extract parameter from http request: javax.ws.rs.PathParam("contact-id") value is '5137069722566656deals' for public com.agilecrm.contact.Contact com.agilecrm.core.api.contacts.ContactsAPI.getContact(java.lang.Long) throws com.agilecrm.user.access.exception.AccessDeniedException</h1>
</body></html>

NO License Information

Can you please Update the README with your License Information? Without License Information your software can not be used in most companies.

page_size parameter

I am creating an app in freshdeveloper to comunicate it with Agile CRM, is already done but I have a limit to show the notes to only 10 results. I noted that if I modify agilecrm.js and add notes?page_size=1000 in the options.path inside ContactAPI.prototype.getNoteByContactId it shows every note. But when the app is compiled it install the original agilecrm.js

It is posible to set page_size outside agilecrm.js?

Problem on duplicate contact

In ContactAPI.prototype.add function when I try to create a new contact,

It returns "Sorry, duplicate contact found with the same email address." with a success response. Then it tries to parse it
var contacts = JSON.parse(body);

gets an exception and it says "Unexpected token S" and cant see real error.

Status Code Spam

Hi,
Since the update of the 24th of October, my server logs are getting totally messed up because of the 'Status Code = XXX'. Could it be possible to be able to activate or not those log with a property on AgileCRM initialization ? And it would be nice to add some info to those console.log, it doesn't give any information on which request / function / process has been done.

Thanks

getContactByEmail throws exception if no contact found

If no contact is found the response body is an empty string. The code attempts to parse this as JSON and throws an exception. This implies that the code has failed but an empty response is a valid response as there may well be no contact in the database with a specific email address.

Proposal is to check the body and if the body is an empty string return undefined.

make this library promise based?

Do you plan to make this library promise based anytime soon?

Things have changed a lot in nodejs world lately... callbacks are a thing of the past, promises are the present and now latest node versions support async/await out of the box (still promises but with a nice syntax)

Also, the way you handle callback is kind of "old school JS" (success and error callbacks instead of error first callbacks) so this lib cannot even be promisified the standard way

"deleteContact" returning error

Delete contact is returning an error, saying contact is not defined. This seems to be an issue with the library but it may be my implementation.'
agileAPI.contactAPI.deleteContact("5724499700416512", success, error);
agileAPI being the obj referenced in the docs. I can get data from agile and upload data but cannot delete any entries by id.

Fork with fixes

Hi All,

I've created a fork https://github.com/pnmcosta/agile_crm with some things addresses:

  • Proper error handling
  • Clean up and tidy

You can replace the npm package with the fork, if you

npm install pnmcosta/agile_crm

Or change your package dependency to:

  "dependencies": {
    "agile_crm": "github:pnmcosta/agile_crm"
  }

To AgileCRM, feel free to use my changes on your package.

Cheers,
P.

Missing error handling code

I'm having a lot of difficulty with connect ETIMEDOUT and agilecrm server but that's not the issue here. I was experiencing some of them while using the contact update method. Digging into your code, I found that some error handling code is missing for a lot of methods
.add()
.update()
.deleteContact()
(and 20 more)
Please consider adding this piece of code like you did for .getContactById()

/*https request*/
.on("error", function(e){
        if (failure) {
            failure(e);
        }
    });

Thx

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.