1. Packages
  2. Restapi Provider
  3. API Docs
  4. getObject
restapi 2.0.1 published on Tuesday, Apr 15, 2025 by mastercard

restapi.getObject

Explore with Pulumi AI

restapi logo
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.
    SearchKey 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.
    SearchValue 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.
    IdAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    QueryString string
    An optional query string to send when performing the search.
    ReadQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    ResultsKey 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.
    SearchData string
    Valid JSON object to pass to search request as body
    SearchPath 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.
    SearchKey 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.
    SearchValue 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.
    IdAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    QueryString string
    An optional query string to send when performing the search.
    ReadQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    ResultsKey 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.
    SearchData string
    Valid JSON object to pass to search request as body
    SearchPath 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.
    searchKey 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.
    searchValue 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.
    idAttribute String
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString String
    An optional query string to send when performing the search.
    readQueryString String
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData String
    Valid JSON object to pass to search request as body
    searchPath 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.
    searchKey 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.
    searchValue 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.
    idAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString string
    An optional query string to send when performing the search.
    readQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData string
    Valid JSON object to pass to search request as body
    searchPath 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 of id_attribute (see id_attribute provider config documentation)
    query_string str
    An optional query string to send when performing the search.
    read_query_string str
    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.
    searchKey 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.
    searchValue 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.
    idAttribute String
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString String
    An optional query string to send when performing the search.
    readQueryString String
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData String
    Valid JSON object to pass to search request as body
    searchPath 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:

    ApiData Dictionary<string, string>
    ApiResponse 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.
    SearchKey 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.
    SearchValue 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.
    IdAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    QueryString string
    An optional query string to send when performing the search.
    ReadQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    ResultsKey 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.
    SearchData string
    Valid JSON object to pass to search request as body
    SearchPath 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.
    ApiData map[string]string
    ApiResponse 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.
    SearchKey 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.
    SearchValue 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.
    IdAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    QueryString string
    An optional query string to send when performing the search.
    ReadQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    ResultsKey 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.
    SearchData string
    Valid JSON object to pass to search request as body
    SearchPath 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.
    apiData Map<String,String>
    apiResponse 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.
    searchKey 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.
    searchValue 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.
    idAttribute String
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString String
    An optional query string to send when performing the search.
    readQueryString String
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData String
    Valid JSON object to pass to search request as body
    searchPath 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.
    apiData {[key: string]: string}
    apiResponse 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.
    searchKey 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.
    searchValue 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.
    idAttribute string
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString string
    An optional query string to send when performing the search.
    readQueryString string
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData string
    Valid JSON object to pass to search request as body
    searchPath 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 of id_attribute (see id_attribute provider config documentation)
    query_string str
    An optional query string to send when performing the search.
    read_query_string str
    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.
    apiData Map<String>
    apiResponse 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.
    searchKey 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.
    searchValue 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.
    idAttribute String
    Defaults to id_attribute set on the provider. Allows per-resource override of id_attribute (see id_attribute provider config documentation)
    queryString String
    An optional query string to send when performing the search.
    readQueryString String
    Defaults to query_string set on data source. This key allows setting a different or empty query string for reading the object.
    resultsKey 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.
    searchData String
    Valid JSON object to pass to search request as body
    searchPath 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 logo
    restapi 2.0.1 published on Tuesday, Apr 15, 2025 by mastercard