> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XblHttpCallPerformAsync

> Performs an HTTP call by using an XblHttpCallHandle.

Performs an HTTP call by using an XblHttpCallHandle.

## Syntax

```cpp theme={null}
HRESULT XblHttpCallPerformAsync(  
         XblHttpCallHandle call,  
         XblHttpCallResponseBodyType type,  
         XAsyncBlock* asyncBlock  
)  
```

### Parameters

*call*   \_In\_\
Type: [XblHttpCallHandle](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/handles/xblhttpcallhandle.md)

The handle of the HTTP call.

*type*   \_In\_\
Type: [XblHttpCallResponseBodyType](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/enums/xblhttpcallresponsebodytype.md)

The response body type to read the results of this HTTP call. We recommend `XblHttpCallResponseBodyType::String` if you read the response with [XblHttpCallGetResponseString](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsestring.md), or `XblHttpCallResponseBodyType::Vector` if you read it with [XblHttpCallGetResponseBodyBytesSize](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytessize.md) and [XblHttpCallGetResponseBodyBytes](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytes.md). This value doesn't influence the content-type header, which must be supplied by calling [XblHttpCallRequestSetHeader](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetheader.md).

*asyncBlock*   \_Inout\_\
Type: XAsyncBlock\*

The XAsyncBlock that defines the async operation.

### Return value

Type: HRESULT

Result code for this API operation. Possible values are S\_OK, E\_INVALIDARG, E\_OUTOFMEMORY, or E\_FAIL.

## Remarks

First, create an HTTP call handle by calling [XblHttpCallCreate](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallcreate.md). Then prepare the request by calling the `XblHttpCallRequestSet*` functions, such as [XblHttpCallRequestSetHeader](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetheader.md). Finally, call `XblHttpCallPerformAsync`.

The call is asynchronous. The task queue in *asyncBlock* determines where the work and the completion callback run. For example, if the queue uses manual dispatch, the work runs on the thread that calls `XTaskQueueDispatch(..., XTaskQueuePort::Work)`, and the callback runs on the thread that calls `XTaskQueueDispatch(..., XTaskQueuePort::Completion)`.

In the completion callback, call `XAsyncGetStatus` to get the result of the asynchronous operation. After the HTTP task completes, read the response by calling functions such as [XblHttpCallGetStatusCode](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetstatuscode.md), [XblHttpCallGetNetworkErrorCode](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetnetworkerrorcode.md), [XblHttpCallGetHeader](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetheader.md), [XblHttpCallGetResponseString](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsestring.md), or [XblHttpCallGetResponseBodyBytes](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytes.md). XSAPI currently ignores *type*, so you can read the response with either the string function or the response body bytes functions.

You can call `XblHttpCallPerformAsync` only once for each handle. To repeat the call, create a new handle. When you no longer need the handle, call [XblHttpCallCloseHandle](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallclosehandle.md) to free the memory associated with it.

## Requirements

**Header:** http\_call\_c.h

**Library:** Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

## See also

[http\_call\_c](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/http_call_c_members.md)


## Related topics

- [XblHttpCallRequestSetLongHttpCall](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallrequestsetlonghttpcall.md)
- [XblHttpCallGetResponseString](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsestring.md)
- [XblHttpCallGetResponseBodyBytes](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytes.md)
- [XblHttpCallGetResponseBodyBytesSize](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetresponsebodybytessize.md)
- [XblHttpCallGetHeader](https://docs.xbox.com/reference/live/xsapi-c/http_call_c/functions/xblhttpcallgetheader.md)
