Skip to main content
All CollectionsWrk Action LibraryHugging Face
Perform an API call in Hugging Face
Perform an API call in Hugging Face
Bassem Khalifa avatar
Written by Bassem Khalifa
Updated over a week ago

Perform an API call in Hugging Face. Please refer to the API documentation for more details on configuration. API doc: https://huggingface.co/docs

Application

  • Hugging Face

Inputs (what you have)

Name

Description

Data Type

Required?

Example

Endpoint

The URL of the API endpoint to access

Text (Long)

Yes

Method

The HTTP method to be used for the request

Predefined Choice List

Yes

GET

Request headers

Additional headers to include in the request in JSON format

Text (Long)

No

{"Content-Type": "application/json"}

Request body

The data to be included in the request body

Text (Long)

No

{"name": "John", "age": 25}

File

A file to be included in the request

File

No

example.png

Output response as a file?

Select this as true when your API call returns a file as an output

True or False

No

Note: the value of inputs can either be a set value in the configuration of the Wrk Action within the Wrkflow, or a variable from the Data library section. These variables in the Data library section are the outputs of previous Wrk Actions in the Wrkflow.

Outputs (what you get)

Name

Description

Data Type

Required?

Example

Response status code

The HTTP status code returned in the response

Integer

Yes

200

Response headers

Additional information provided in the response headers

Text (Long)

Yes

Content-Type: application/json

Response body

The main content of the response

Text (Long)

Yes

{"message": "Success"}

Downloaded file

A file that is downloaded as part of the response

File

Yes

example.pdf

Outcomes

Name

Description

Success

This status is selected in the event of that the API call returns with a status between 200-399

Unsuccessful

This status is selected in the event of that the API call returns with a status of 400+

Impossible to Complete

This status is selected in the event of the following scenario:

  • Couldn't resolve hostname

  • The external system is not accessible

Requirements

  • N/A

Did this answer your question?