Uses your Google Cloud location to construct a search term or you can input your own search term to pass to the Wikipedia API. A list of related Wikipedia articles is returned.

## Explore further


For detailed documentation that includes this code sample, see the following:

- [Calls](https://docs.cloud.google.com/workflows/docs/reference/syntax/calls)
- [Make an HTTP request](https://docs.cloud.google.com/workflows/docs/http-requests)
- [Quickstart: Create a workflow by using the gcloud CLI](https://docs.cloud.google.com/workflows/docs/create-workflow-gcloud)
- [Quickstart: Create a workflow by using the Google Cloud console](https://docs.cloud.google.com/workflows/docs/create-workflow-console)

## Code sample

### YAML

    main:
      params: [input]
      steps:
        - checkSearchTermInInput:
            switch:
              - condition: '${"searchTerm" in input}'
                assign:
                  - searchTerm: '${input.searchTerm}'
                next: readWikipedia
        - getLocation:
            call: sys.get_env
            args:
              name: GOOGLE_CLOUD_LOCATION
            result: location
        - setFromCallResult:
            assign:
              - searchTerm: '${text.split(location, "-")[0]}'
        - readWikipedia:
            call: http.get
            args:
              url: 'https://en.wikipedia.org/w/api.php'
              query:
                action: opensearch
                search: '${searchTerm}'
            result: wikiResult
        - returnOutput:
            return: '${wikiResult.body[1]}'

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples?product=workflows).