HMG Powershell

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
nekbmm
Posts: 122
Joined: Sat Jul 16, 2016 3:16 am
DBs Used: DBF,SQLite
Location: Ivanjica, Serbia

HMG Powershell

Post by nekbmm »

Code: Select all

How to call these API commands from HMG ?



////////////
Login
////////////



$params = @{
Method = 'Post'
Uri = "https://rcrf.trezor.gov.rs/api/login"
ContentType = 'application/json'
Body = @{ login = 'foo'; password = 'bar' } | ConvertTo-Json
}
Invoke-RestMethod @params

////////////
Output
////////////

{
"creationTime": "2018-02-23T21:00:30.5262037+01:00",
"accessToken": "eyJ1ba1A3jdeC0....",
"refreshToken": "eyJ1bmlxdWVfbm...."
}



$invoices = @(
@{
DebtorCompanyNumber = '10523'
InvoiceNumber = 'Racun 18/01'
Amount = 1001
IssueDate = '2018-02-28'
Comments = 'Komentar 1'
}
@{
DebtorCompanyNumber = '10523'
InvoiceNumber = 'Racun 18/02'
Amount = 1002.33
IssueDate = '2018-02-28'
Comments = 'Komentar 2'
Lifetime = 88
}
) | ConvertTo-Json

irm "https://rcrf.trezor.gov.rs/api/invoice/register" @params -Body $invoices
Post Reply