Reply
Ubiquiti Employee
Posts: 2,807
Registered: ‎12-10-2015
Kudos: 1011
Solutions: 231

Re: UCRM API

yes, service status can be added.

 

/clients/services returns all services, , even if the service has ended

this is intended because someone may want to know about all the services, especially when they were ended or the client was archived, for example to process shaping or suspension.

Ubiquiti Employee
Posts: 2,807
Registered: ‎12-10-2015
Kudos: 1011
Solutions: 231

Re: UCRM API

@CC_DKP the proper way how to filter the invoices or any other results of the GET method should be done using the URI parameters (don't use parameters in the BODY). We have updated the API documentation to make it clear:

http://docs.ucrm.apiary.io/#reference/invoices/invoicesclientidcreateddatefromcreateddateto/get

 

For example:

https://ucrm-demo.ubnt.com/api/v1.0/invoices?clientId=1&createdDateFrom=2016-01-01&createdDateTo=2016-12-31

 

 

New Member
Posts: 34
Registered: ‎05-30-2014
Kudos: 34
Solutions: 5

Re: UCRM API

It would be nice to be able to read the management IP for a device (/devices and /devices/id).

 

Additionally, is there a way to query ip addresses associated with a device interface (/devices/id/device-interfaces or /devices/device-interfaces/id). This query is already present on the web interface (https://ucrm-demo.ubnt.com/interface/XXXX/get-ips-on-device where XXXX is the device_interface id), just not in the api.

 

I noticed we had accidentally created a few duplicate devices during entry, and I was attempting to use the API to look for duplicates. I eventually had to use device interface MAC address, which unfortunately is not available for all devices. Being able to use management IP would greatly reduce this difficulty (as well as let me identify devices that don't have a management IP set and need updating). 

 

I as many of our customers were added before we had all the device syncing set up correctly, I have noticed some service devices are associated to the wrong towers. I have no way to programatically verify this information. If device_interface IPs were present, I could at least do the same sanity check the web interface does (checking that service_device IP is similar to the IP of the device_interface).

Ubiquiti Employee
Posts: 2,807
Registered: ‎12-10-2015
Kudos: 1011
Solutions: 231

Re: UCRM API

[ Edited ]

@CC_DKPcheck out the "status" attribute: http://docs.ucrm.apiary.io/#reference/services/clientsservices/get

0 Prepared
1 Active
2 Ended
3 Suspended
4 Prepared blocked
5 Obsolete
6 Deferred

New Member
Posts: 18
Registered: ‎07-04-2016
Kudos: 9

Re: UCRM API

I have a question about the API to create a ticket here:

 

http://docs.ucrm.apiary.io/#reference/tickets/ticketingtickets/post

 

In the comments array, a ticketId is required. Since I am creating a new ticket, I would not have a ticket ID. Could someone please help me to understand this?

 

 

Ubiquiti Employee
Posts: 926
Registered: ‎03-21-2016
Kudos: 150
Solutions: 111

Re: UCRM API

Hello @kle, the documentation is wrong, you don't have to give a ticket ID when creating a ticket. Thank you for pointing this out, will fix it.

New Member
Posts: 8
Registered: ‎07-04-2016
Kudos: 2

Re: UCRM API

Emerging Member
Posts: 87
Registered: ‎03-16-2014
Kudos: 20
Solutions: 2

Re: UCRM API

Can someone point me in the correct direction how I could optain the following:\

 

Retrieve collection of Service IPs filtered by Service Status.

 

I want to get a list that contains only service IPs for clients who have a suspended status.

Ubiquiti Employee
Posts: 926
Registered: ‎03-21-2016
Kudos: 150
Solutions: 111

Re: UCRM API

Hello @superbree, there is no direct endpoint in the API to do this, it will require a bit of scripting and couple of API endpoints.

First you'll have to get all services with the /clients/services (http://docs.ucrm.apiary.io/#reference/services/clientsservices/get) endpoint.

Then you'll have to manually filter the received array to have only services with the status you want (suspended = 3).

After you have this, you will have to get the service devices for each service ID in the filtered array using the /clients/services/id/service-devices (http://docs.ucrm.apiary.io/#reference/service-devices/clientsservicesservice-devicesid/get) endpoint.

And finally from those, you can get the IP's using the /clients/services/service-devices/id/service-ips (http://docs.ucrm.apiary.io/#reference/service-ips/clientsservicesservice-devicesidservice-ips/get) endpoint.

Ubiquiti Employee
Posts: 2,807
Registered: ‎12-10-2015
Kudos: 1011
Solutions: 231

Re: UCRM API

@superbree most probably, we will introduce a more suitable API endpoint for this use case soon.
New Member
Posts: 34
Registered: ‎05-30-2014
Kudos: 34
Solutions: 5

Re: UCRM API

Service IPs appear to be included in the default service list as an array under `ipRanges` element.

 

The code would only require a single API call to /client/services, then iterate through the response, checking `status` and printing `ipRanges` as appropriate.

 

 

New Member
Posts: 34
Registered: ‎12-13-2017
Kudos: 23

Re: UCRM API

[ Edited ]

I'm getting "HTTP Error 422: Unprocessable Entity" when trying to update an invoice through the API. Is there an issue with updateing invoices through the API now?

 

It was because a partial payment had been applied to the invoice. Figured it out.

Ubiquiti Employee
Posts: 2,807
Registered: ‎12-10-2015
Kudos: 1011
Solutions: 231

Re: UCRM API

@kysevenle thanks for info. Yes, paid or partially paid invoices cannot be modified manually. However, we will make this notice more user-friendly.
Emerging Member
Posts: 85
Registered: ‎03-19-2018
Kudos: 14
Solutions: 2

Re: UCRM API

What is the use case for the payment endpoint? If I were to set the method = to 7 (Stripe subscription (credit card)) can I post a cc or stripe token? If so, how?

HTML, SCSS, Javascript(Ember.js), Ruby(Ruby on Rails), PHP
Ubiquiti Employee
Posts: 926
Registered: ‎03-21-2016
Kudos: 150
Solutions: 111

Re: UCRM API

Hello @Brandon-W, no, you cannot post a cc or stripe token. The endpoint is used to create a new payment in UCRM, just as if you would that with a new payment form on the web.

Emerging Member
Posts: 85
Registered: ‎03-19-2018
Kudos: 14
Solutions: 2

Re: UCRM API

Thank you for clarifying @UBNT-Ondra Would it theoretically be possible to create the charge directly with stripe then use the UCRM api to make a payment and mark it as complete? Or taking it a step further could it be tied with an existing subscription in stripe?

 

I've been studying the api for the past couple weeks as I've been developing a custom client signup form with scheduling and payment. So I'll keep looking, but input on current api limitations is helpful. I appreciate the help, you guys are providing a great service.

HTML, SCSS, Javascript(Ember.js), Ruby(Ruby on Rails), PHP
Ubiquiti Employee
Posts: 926
Registered: ‎03-21-2016
Kudos: 150
Solutions: 111

Re: UCRM API

@Brandon-W  I don't think I understand what you mean by marking the payment as complete or tying it with a subscription. Via UCRM API you can create new Payment entity just for UCRM. You give it all the details you want, most importantly amount, currency and clientId.

If you send the "applyToInvoicesAutomatically" field as true, it will apply itself on all unpaid invoices of the client starting with the oldest one. If you don't want this, you can either send exact IDs of invoices you want it applied to, or just put it in client's credit and then use that credit in UCRM to pay for stuff manually.

Once the payment entity is made, UCRM does not care in any way if it was linked with payment provider (stripe) or not. If it goes through integrated process, the only difference is, that there will be fields like "stripeId", "sourceCardId", "sourceFingerprint", etc. This is not possible via API, however you *can* with API create a payment with method "custom" and fill details like this on your own.

So, basically UCRM does not care if you made payment via Stripe or not, if you do it using your own implementation and then just want to put the payment into UCRM and pay for unpaid invoices, you can do that.

Emerging Member
Posts: 85
Registered: ‎03-19-2018
Kudos: 14
Solutions: 2

Re: UCRM API

That explaination helps, @UBNT-Ondra thank you.

 

What I meant by 'tying' together is if a subscription exists in stripe can I create a subscription on ucrm that is aware of ongoing payments and when they go through or not.

HTML, SCSS, Javascript(Ember.js), Ruby(Ruby on Rails), PHP
Ubiquiti Employee
Posts: 926
Registered: ‎03-21-2016
Kudos: 150
Solutions: 111

Re: UCRM API

@Brandon-W  Thanks for the explanation, no, tying is not possible currently. We are preparing a way for users to implement custom payment providers via UCRM plugins, it might be possible after this is implemented, but I can't promise that yet.

Emerging Member
Posts: 85
Registered: ‎03-19-2018
Kudos: 14
Solutions: 2

Re: UCRM API

I just looked into the plugins, and they do look promising. @UBNT-Ondra

 

I'd be very interested in developing a plugin that allows for the binding I'm looking for in stripe. Basically I want to be able to have a frontend application (ember in my case) be able to create a stripe subscription that will begin charging the client immediately even before they go into their account because they've already gone through a checkout that creates their client, schedules a job, and selects a service.

 

If there is need for it I'd be willing to collaborate on whatever is in the works or develop the plugin myself in order to push the feature forward. I'll jump over to the other thread to ask more questions.

 

 

HTML, SCSS, Javascript(Ember.js), Ruby(Ruby on Rails), PHP
Reply