Previous Topic

Next Topic

HttpRequest Object

The HttpRequest Object can be used to interact with a server via http. HTTP works as a request-response protocol between Accredo and the server.

HttpRequest Object has the following Methods:

ClearLog

Clear the HttpRequest log.

Get

Requests data from the server.

GetLog

GetLog returns a readonly string property.

Note: The log doesn't differentiate between the types of messages (i.e connection status etc vs response) so it will contain everything that the ShowLog window would normally contain.

Patch

Sends data to the server to update information. Patch will only update fields specified in the json body request.

Post

Sends data to the server to create or update information. Using a Post request more than once can result in multiple instances being created. Post must be used to insert where a key is system generated, such as for Documents or Transactions.

PostForm

Takes a HttpFormBuilder object and posts it to the server.

Put

Sends data to the server to create or update information. This is different from the Post method, as using this more than once will always have the same result.

Put requests must include the entity's ID in the URL. If the ID is found it will be updated, otherwise a new entity will be inserted.

For updates, any fields not specified in the json body request will be cleared. It is recommended to use Patch for updates.

SetRequestHeader

Takes a Header string and a Value string, and sets the Header to the Value.

ShowLog

Displays the HttpRequest log with details of all requests processed.

UseBasicAuthentication

Takes a UserName and Password and authenticates on the server.

Note: Log output from the object in scripts called from an event or the PlayScript endpoint via the Web Service is not returned but may be logged using User logging. User logging may be enabled in Web Service Monitor > Settings > Logging tab, and viewed under Web Service Log File Viewer.

See Also

MaxBasic Objects

Book Contents

Book Index