restapi 2.0.1 published on Tuesday, Apr 15, 2025 by mastercard
restapi.getObject
Explore with Pulumi AI
restapi 2.0.1 published on Tuesday, Apr 15, 2025 by mastercard
Performs a cURL get command on the specified url.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as restapi from "@pulumi/restapi";
const john = restapi.getObject({
path: "/api/objects",
searchKey: "first",
searchValue: "John",
});
import pulumi
import pulumi_restapi as restapi
john = restapi.get_object(path="/api/objects",
search_key="first",
search_value="John")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/restapi/v2/restapi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := restapi.LookupObject(ctx, &restapi.LookupObjectArgs{
Path: "/api/objects",
SearchKey: "first",
SearchValue: "John",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Restapi = Pulumi.Restapi;
return await Deployment.RunAsync(() =>
{
var john = Restapi.GetObject.Invoke(new()
{
Path = "/api/objects",
SearchKey = "first",
SearchValue = "John",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.restapi.RestapiFunctions;
import com.pulumi.restapi.inputs.GetObjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var john = RestapiFunctions.getObject(GetObjectArgs.builder()
.path("/api/objects")
.searchKey("first")
.searchValue("John")
.build());
}
}
variables:
john:
fn::invoke:
function: restapi:getObject
arguments:
path: /api/objects
searchKey: first
searchValue: John
Using getObject
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getObject(args: GetObjectArgs, opts?: InvokeOptions): Promise<GetObjectResult>
function getObjectOutput(args: GetObjectOutputArgs, opts?: InvokeOptions): Output<GetObjectResult>
def get_object(debug: Optional[bool] = None,
id: Optional[str] = None,
id_attribute: Optional[str] = None,
path: Optional[str] = None,
query_string: Optional[str] = None,
read_query_string: Optional[str] = None,
results_key: Optional[str] = None,
search_data: Optional[str] = None,
search_key: Optional[str] = None,
search_path: Optional[str] = None,
search_value: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetObjectResult
def get_object_output(debug: Optional[pulumi.Input[bool]] = None,
id: Optional[pulumi.Input[str]] = None,
id_attribute: Optional[pulumi.Input[str]] = None,
path: Optional[pulumi.Input[str]] = None,
query_string: Optional[pulumi.Input[str]] = None,
read_query_string: Optional[pulumi.Input[str]] = None,
results_key: Optional[pulumi.Input[str]] = None,
search_data: Optional[pulumi.Input[str]] = None,
search_key: Optional[pulumi.Input[str]] = None,
search_path: Optional[pulumi.Input[str]] = None,
search_value: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetObjectResult]
func LookupObject(ctx *Context, args *LookupObjectArgs, opts ...InvokeOption) (*LookupObjectResult, error)
func LookupObjectOutput(ctx *Context, args *LookupObjectOutputArgs, opts ...InvokeOption) LookupObjectResultOutput
> Note: This function is named LookupObject
in the Go SDK.
public static class GetObject
{
public static Task<GetObjectResult> InvokeAsync(GetObjectArgs args, InvokeOptions? opts = null)
public static Output<GetObjectResult> Invoke(GetObjectInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetObjectResult> getObject(GetObjectArgs args, InvokeOptions options)
public static Output<GetObjectResult> getObject(GetObjectArgs args, InvokeOptions options)
fn::invoke:
function: restapi:index/getObject:getObject
arguments:
# arguments dictionary
The following arguments are supported:
- Path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- Search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- Search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- Debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- Id string
- The ID of this resource.
- Id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - Query
String string - An optional query string to send when performing the search.
- Read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - Results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- Search
Data string - Valid JSON object to pass to search request as body
- Search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- Path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- Search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- Search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- Debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- Id string
- The ID of this resource.
- Id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - Query
String string - An optional query string to send when performing the search.
- Read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - Results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- Search
Data string - Valid JSON object to pass to search request as body
- Search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- path String
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key String - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value String - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug Boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id String
- The ID of this resource.
- id
Attribute String - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String String - An optional query string to send when performing the search.
- read
Query StringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key String - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data String - Valid JSON object to pass to search request as body
- search
Path String - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id string
- The ID of this resource.
- id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String string - An optional query string to send when performing the search.
- read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data string - Valid JSON object to pass to search request as body
- search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- path str
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search_
key str - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search_
value str - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- id str
- The ID of this resource.
- id_
attribute str - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query_
string str - An optional query string to send when performing the search.
- read_
query_ strstring - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results_
key str - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search_
data str - Valid JSON object to pass to search request as body
- search_
path str - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- path String
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key String - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value String - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug Boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id String
- The ID of this resource.
- id
Attribute String - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String String - An optional query string to send when performing the search.
- read
Query StringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key String - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data String - Valid JSON object to pass to search request as body
- search
Path String - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
getObject Result
The following output properties are available:
- Api
Data Dictionary<string, string> - Api
Response string - The raw body of the HTTP response from the last read of the object.
- Id string
- The ID of this resource.
- Path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- Search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- Search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- Debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- Id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - Query
String string - An optional query string to send when performing the search.
- Read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - Results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- Search
Data string - Valid JSON object to pass to search request as body
- Search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- Api
Data map[string]string - Api
Response string - The raw body of the HTTP response from the last read of the object.
- Id string
- The ID of this resource.
- Path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- Search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- Search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- Debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- Id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - Query
String string - An optional query string to send when performing the search.
- Read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - Results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- Search
Data string - Valid JSON object to pass to search request as body
- Search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- api
Data Map<String,String> - api
Response String - The raw body of the HTTP response from the last read of the object.
- id String
- The ID of this resource.
- path String
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key String - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value String - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug Boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id
Attribute String - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String String - An optional query string to send when performing the search.
- read
Query StringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key String - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data String - Valid JSON object to pass to search request as body
- search
Path String - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- api
Data {[key: string]: string} - api
Response string - The raw body of the HTTP response from the last read of the object.
- id string
- The ID of this resource.
- path string
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key string - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value string - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id
Attribute string - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String string - An optional query string to send when performing the search.
- read
Query stringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key string - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data string - Valid JSON object to pass to search request as body
- search
Path string - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- api_
data Mapping[str, str] - api_
response str - The raw body of the HTTP response from the last read of the object.
- id str
- The ID of this resource.
- path str
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search_
key str - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search_
value str - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug bool
- Whether to emit verbose debug output while working with the API object on the server.
- id_
attribute str - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query_
string str - An optional query string to send when performing the search.
- read_
query_ strstring - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results_
key str - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search_
data str - Valid JSON object to pass to search request as body
- search_
path str - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
- api
Data Map<String> - api
Response String - The raw body of the HTTP response from the last read of the object.
- id String
- The ID of this resource.
- path String
- The API path on top of the base URL set in the provider that represents objects of this type on the API server.
- search
Key String - When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.
- search
Value String - The value of 'searchkey' will be compared to this value to determine if the correct object was found. Example: if 'searchkey' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
- debug Boolean
- Whether to emit verbose debug output while working with the API object on the server.
- id
Attribute String - Defaults to
id_attribute
set on the provider. Allows per-resource override ofid_attribute
(seeid_attribute
provider config documentation) - query
String String - An optional query string to send when performing the search.
- read
Query StringString - Defaults to
query_string
set on data source. This key allows setting a different or empty query string for reading the object. - results
Key String - When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is.
- search
Data String - Valid JSON object to pass to search request as body
- search
Path String - The API path on top of the base URL set in the provider that represents the location to search for objects of this type on the API server. If not set, defaults to the value of path.
Package Details
- Repository
- restapi mastercard/terraform-provider-restapi
- License
- Notes
- This Pulumi package is based on the
restapi
Terraform Provider.
restapi 2.0.1 published on Tuesday, Apr 15, 2025 by mastercard