Response/Return values to API call
Closed this issue · 3 comments
kmschmehl commented
Hi there -
Thanks for making this module - very useful! I am trying to make a custom failure response if my script meets a certain criteria. Is there any support/examples for returning a non-standard failure response?
jpsider commented
what would you expect the response to look like?
kmschmehl commented
I’d like to provide a custom return from my functions with more descriptive messages. For instance, if I run a try/catch in the catch area I’d like to be descriptive about why the API call failed (couldn’t find object, object already exists, etc) or provide the error message from the API/function that I am calling.
From what I can tell if I return a message/json, the status returned is always 0. I’d like to return a string/json and specify the status code returned.
…________________________________
From: Justin Sider ***@***.***>
Sent: Monday, November 1, 2021 7:48:32 AM
To: jpsider/RestPS ***@***.***>
Cc: kmschmehl ***@***.***>; Author ***@***.***>
Subject: Re: [jpsider/RestPS] Response/Return values to API call (Issue #62)
what would you expect the response to look like?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHYQY6RRTYJRUC3ZV7MJY4DUJZ5BBANCNFSM5GYWEXVQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
jpsider commented
You should be able to achieve this by these two settings in your script:
$script:StatusCode
$script:StatusDescription