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

# WebSession.fetchByVid

The `fetchByVid` method returns an existing `WebSession` object that matches the input VID. Make this call once you receive the success or failure status from the form post, which will be after HOA has created the object according to the corresponding `WebSession` object’s `method` attribute. HOA includes the `WebSession` object’s VID in the redirection URL to make the VID available to you in your success or failure page code.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*vid*: the `WebSession` object’s Vindicia identifier, which serves as the search criterion. This VID corresponds to the `vin_WebSession_vid` element in the order form submitted by the customer to HOA.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*session*: the `WebSession` object that matches the input VID.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | `No VID specified to load session by.` |
| `404` | `Unable to load session: No match for VID *vid*.` |
| `500` | `Unable to load session by VID *vid: error-description*.` |

## Example

```

$sessionId = …; //passed in by redirected page

$soap = new WebSession($soapLogin, $soapPwd);

$response = $soap->fetchByVID($sessionId);
if ($response['returnCode'] == 200) {

   $fetchedWs = $response['data']->session;

   // Extract non-Vindicia values submitted by the web order form
   // and process them to prepare the HTML to be returned to
   // the customer
   $postVals = $fetchedWs->getPostValues()

   // Assuming HOA created an AutoBill object, let's fetch it
   $soapAbill = new AutoBill($soapLogin, $soapPwd);
   $resp = $soapAbill->fetchByWebSessionVid($sessionId);

   if ($resp['returnCode'] == 200) {
      $createdAutoBill = $resp['data']->autobill;

      // Get AutoBill contents here to be included in
      // HTML returned to the customer.
   }
   else {
      // Return error message to customer
   }
}
else {
   // Return error message to the customer
} 
```

**Parent topic:**[WebSession Methods](../topics/WebSession_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.