API Example of getting and deleting a sales credit settlement jnl
// PART 1 sUrlString is string = “/Sale/CreditSettlement?$top=1000&$filter=Date ge datetime’2024-05-20’ and Date le datetime’2024-05-20’” sDestination is string = “c:\Junk\RDL22a.txt” vJsonReturned is Variant = gclCloud.getJson(sUrlString,sDestination) // info(vjsonreturned)
// Part 2
// Open json file //vJsonReturned is variant = json //jz is JSON = StringToJSON(sJZon)
// Open an external file ////MyFile is DiskFile ////ResOpening = fOpen(“c:\junk\RDL1a.tx”, foReadWrite) jz is Variant sFileContent is string = fLoadText(“c:\junk\RDL22a.txt”) IF NOT ErrorOccurred THEN jz = StringToJSON(sFileContent) END // info( jz)
// jz is variant = JSONToVariant(HTTP_Res) nJzOccurs is int = jz.items..Occurrence // number of lines in this URI eg top=400 so shows 400 not 805 nJzCount is int = jz..Member3 // Number of lines in total data set eg 805 nSkip is int = nSkip + nJzOccurs IF nJzCount = 0 THEN InfoWithTimeout(500, “Data not in MYOB”) gsErrMessage = “No Data to process” Info(“RESULT False”) ELSE // InfoWithTimeout(500,“Transactions = “ + NumToString(nSkip) + “ of “ + NumToString(nJzCount)) END
// sPUrlString is string = “/Sale/CreditSettlement?$top=1000&$filter=Date ge datetime’2024-05-20’ and Date le datetime’2024-05-20’” // Immagine – delete the URI = https://arl2.api.myob.com/accountright/49ff204f-cf26-4fd0-9748-9acab9071154/Sale/CreditSettlement/7c7cbde8-30d9-43c3-88d5-dc8e8619c491 sUrlString = “/Sale/CreditSettlement/7c7cbde8-30d9-43c3-88d5-dc8e8619c491” vJsonDeleted is Variant = gclCloud.Json_Delete(sUrlString)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article