HOME / COMMUNITY Switch to knowledge base

Creating a link to the API

It would be very useful to create an AIP call from our membership database to return from Quickfile, all members with an active recurring profile, and the amount on the profile.

Our membership database is written in PHP 7

Please could you advise if such an API call is possible and, if so, some guidance on setting this up.

Best regards

Mike

Hi @Mike

It certainly should be possible, although you would have to look up the recurring invoice list as the two can’t be combined in one call.

Something like:

{
  "payload": {
    "Header": {
      "MessageType": "Request",
      "SubmissionNumber": "00000001",
      "Authentication": {
        "AccNumber": "123456",
        "MD5Value": "7dd259dea3393880406d292e3f6f5830",
        "ApplicationID": "appID"
      }
    },
    "Body": {
      "SearchParameters": {
        "ReturnCount": "200",
        "Offset": "0",
        "OrderResultsBy": "InvoiceNumber",
        "OrderDirection": "ASC",
        "InvoiceType": "RECURRING",
        "Status": "ACTIVE",
        "AdditionalParameters": {
          "ShowPurchaseRef": "true",
          "ShowNetAmount": "true",
          "ShowVatAmount": "true"
        }
      }
    }
  }
}

This should (not tested) return a list of all active recurring invoice profiles, along with a client ID. What may be best is to try and keep a local list of the clients with your own reference and tieing them to their QuickFile reference too, for quicker lookup.

Are you able to tell us any more about your set up at the moment? For example, are you using any frameworks? Are you the coder behind this, or have you got someone doing this on your behalf?

Very many thanks for the customary ‘Quickfile Rapid Response’ for which I am most grateful.

The application was written by me. It uses Object Orientated PHP code, with data stored on the inevitable MYSQL server. Its hosted on a Linux CPanel, courtesey of Zen Internet. I did not use a framework to develop the application but it is possible that, if I get round to doing a re-write, that I might consider this.

Regarding the code, I would be grateful for further advice regarding the ‘wrapper’ for the API, or a pointer to where I can find this in the documentation.

Having brooched the use of the API, I might well consider further extensions. At the moment, people join via the membership portal. This then exports a file that is imported straight into Quickfile and then, as a separate exercise, an invoice is created against the new account. Clearly it would be best if the application process, automatically creates the members account in the quickfile sales ledger, sends the DD request, if the member has indicated that as their preferred meethod of payment and then raises the relevent invoice.

But I am getting ahead of myself, let’s get the recurring invoice profile matched first.

Best regards

Mike

Thanks for the insight - that’s helpful!

We don’t have an official SDK at the moment for you to use out-of-the-box so to speak, but you can put something together using Guzzle for example:

/** Set up a Guzzle Client */
$guzzleClient 	= new GuzzleHttp\Client([
	"base_uri"	=> "https://api.quickfile.co.uk/1.2/"
]);

/** Set up the request array to be converted to JSON
  * This will look for all "Active" recurring invoices, ordered by
  * invoice number in ascending order. This will only return 10 results max.
  **/
$request 	= [
	"payload"	=> [
		"Header"	=> [
			"MessageType"		=> "Request",
			"SubmissionNumber"	=> "00000001",
			"Authentication"	=> [
				"AccNumber"			=> "61314000000",
				"MD5Value"			=> "7dd259dea3393880406d292e3f6f5830",
				"ApplicationID"		=> "appID"
			]
		],
		"Body"		=> [
			"SearchParameters"	=> [
				"ReturnCount"		=> 10,
				"Offset"			=> 0,
				"OrderResultsBy"	=> "InvoiceNumber",
				"OrderDirection"	=> "ASC",
				"InvoiceType"		=> "RECURRING",
				"Status"			=> "ACTIVE"
			]
		]
	]
];

/** Send data to API */
$result = $guzzleClient->post("invoice/search", [
	"json"   => $request
]);

/** Do any error checking here (e.g. error returned, etc.) */

/** Decode the returned data, keep it in the $returnedData variable */
$returnedData = json_decode($result->getBody());

Hope that helps somewhat! :slight_smile: You could in theory have a function that would generate the header for you and handle the errors returned (if any). That would streamline it a bit, and you would just need to create the endpoint specific data (the “Body”) and use that with a custom function.

Note: This code is untested

This topic was automatically closed after 7 days. New replies are no longer allowed.