({{, (RefLink[ServiceRequest, paclet:ref/ServiceRequest])[service,"req"]
represents a service request built from service, which might be a connected (RefLink[ServiceObject, paclet:ref/ServiceObject]) or a valid service name, and request "req".}, {, (RefLink[ServiceRequest, paclet:ref/ServiceRequest])[service,"req",param]
represents a service request, built from the service service, request "req" and parameters param.}, {, (RefLink[ServiceRequest, paclet:ref/ServiceRequest])[assoc]
represents a service request, built from association assoc.}})

OpenersNotesSection(Spacer1)Details

(RefLink[ServiceRequest, paclet:ref/ServiceRequest]) gives a symbolic representation of a service request; it does not execute the request.

The following entries must be given in the association:

(RefLink[ServiceRequest, paclet:ref/ServiceRequest])[…]["prop"] extracts the value for the property prop of the service request.

Possible properties include all components and additional elements, as well as:

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create a request for (StringTypeLink["PubChem", paclet:ref/service/PubChem]) service:

req = ServiceRequest["PubChem","Requests"]

List requests supported by the (StringTypeLink["PubChem", paclet:ref/service/PubChem]) service:

ServiceExecute[req]

Open a connection to an external service:

pubchem = ServiceConnect["PubChem"]

Create a request:

req=ServiceRequest[pubchem,"CompoundDescription",{"InChI"-> "InChI=1S/ClO2/c2-1-3"}]

Get properties:

req["Properties"]

Extract properties from the request:

req[{"ServiceName","Request","Parameters"}]

Get request data as "PropertyAssociation":

req["PropertyAssociation"]

Execute the request:

ServiceExecute[req]

Submit the request and set result:

ServiceSubmit[req,HandlerFunctions-><|"ResultReceived"->((res = #EvaluationResult)&)|>]

res

Build a request with an association:

req = ServiceRequest[<|"Service"->"PubChem","Request"->"Requests"|>]

Execute the request:

ServiceExecute[req]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ServiceSubmit, paclet:ref/ServiceSubmit])  ▪  (RefLink[ServiceExecute, paclet:ref/ServiceExecute])  ▪  (RefLink[ServiceConnect, paclet:ref/ServiceConnect])  ▪  (RefLink[ServiceObject, paclet:ref/ServiceObject])  ▪  (RefLink[HTTPRequest, paclet:ref/HTTPRequest])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Accessing External Services & APIs, paclet:guide/AccessingExternalServicesAndAPIs])}})}})