php - Rest request url -
i have this url
post https://domainname/api/v1/loans/{loanid}/transactions?command=repayment
which used post data php software exposes functionality via rest.
in docs,this information given
post loans/5/transactions?command=repayment content-type: application/json request body: { "dateformat": "dd mmmm yyyy", "locale": "en", "transactiondate": "14 may 2013", "transactionamount": "500.00", "paymenttypeid": "12", "note": "check payment", "accountnumber": "acc123", "checknumber": "che123", "routingcode": "rou123", "receiptnumber": "rec123", "banknumber": "ban123" }
this example loans/5/transactions?command=repayment
loanid
entered 5
how can include other parameters given in request body url?.
if request server https post function, payload data not sent in url. if send payload data in url called request.
to send payload data using post function (data in json format in case) can use curl tool.
for example:
curl --data " { "dateformat": "dd mmmm yyyy", "locale": "en", "transactiondate": "14 may 2013", "transactionamount": "500.00", "paymenttypeid": "12", "note": "check payment", "accountnumber": "acc123", "checknumber": "che123", "routingcode": "rou123", "receiptnumber": "rec123", "banknumber": "ban123" }" -h "content-type: application/json" https://domainname/api/v1/loans/{loanid}/transactions?command=repayment
this run command line. doing request? in program or once?
Comments
Post a Comment