HttpRequest Object
Derived from:
Base Object
Defined in namespace "adsk::core" and the header file is <Core/Application/HttpRequest.h>
Description
Supports the ability to make HTTP requests.
Methods
classType |
Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType(). |
create |
Creates a new HttpRequest object. |
execute |
Execute this request asynchronously. The response will be sent to the completed event. |
executeSync |
Execute this request synchronously. This will block the thread until the request completes. |
getHeader |
Gets the value of the specified header and returns the value. |
hasHeader |
Gets if the request has a header with the given name. This is useful to distinguish between the case where a header is not set and the case where a header is set to an empty string. |
headers |
Get the request headers. |
removeHeader |
Removes a header from the request. |
setHeader |
Sets a header for the request. |
Properties
data |
Gets and sets the body data to send with this request. |
isValid |
Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference. |
method |
Gets and sets the method to use for the request. |
objectType |
This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.
It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType(): |
url |
Gets and sets the URL to make the request to. |
Events
completed |
The completed event fires when the request has completed. This event will fire on successful or failure. |
Accessed From
HttpRequest.create,
HttpResponse.request
Samples
Version
Introduced in version January 2024