> For the complete documentation index, see [llms.txt](https://haptixgames.gitbook.io/web-api-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://haptixgames.gitbook.io/web-api-kit/core/inside-operations.md).

# Inside operations

[WAK](https://www.assetstore.unity3d.com/en/#!/content/19663) operations define everything about an HTTP call.  The information on how to structure the class comes from the API’s documentation.

Let’s take a look at one of Instagram’s endpoints.

![Instagram Endpoint](https://3160023044-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNwokgSPBJBpAv87dWr%2F-LNwte82ztD31Qc5Z0nJ%2F-LNwttx2-jC59G0IBLZC%2Fimage.png?alt=media\&token=45cf0692-428a-47c1-be26-44ab3af2022d)

Let’s take a look at the URI:  [https://api.instagram.com/v1/tags/{tag-name}/media/recent?access\_token=ACCESS-TOKEN\&count=100](https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN\&amp;count=100)<br>

| **Base URI**                                           | **Resource Path**                                                                                            | **Query String**                      |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------- |
| <https://api.instagram.com/v1/>                        | tags/{tag-name}/media/recent                                                                                 | ?access\_token=ACCESS-TOKEN\&count=10 |
| This is our entry point into Intagram’s version 1 API. | Notice the {tag-name}.  This is a URI Template that must be replaced and resolved before making the request. | Parameters as part of the URI.        |

From this information we can begin constructing our operation class.  Any operation class must inherit from `hg.ApiWebKit.core.http.HttpOperation`.

```
[HttpPath(null,"https://api.instagram.com/v1/tags/{$tag}/media/recent")]
[HttpGET]
public class InstagramRecentMediaForTag : hg.ApiWebKit.core.http.HttpOperation
{
    [HttpUriSegment("tag")]
    public string Tag = "gaming";
    
    [HttpQueryString("count")]
    public int Count = 10;
    
    [HttpQueryString]
    public string access_token = "abc123";
}
```

Notice that we are using C# attributes everywhere.  At runtime the URI in the \[HttpPath] attribute will be expanded by using the values from the class fields and will look like this:  [https://api.instagram.com/v1/tags/gaming/media/recent?access\_token=abc123\&count=10](https://api.instagram.com/v1/tags/gaming/media/recent?access_token=abc123\&amp;count=10)

Most attribute constructors in this example accept optional parameters and are really just key-value pairs.  By using the parameterless constructor you are defining the ‘Name’ to be the same as the field name, as seen in the ‘access\_token’ field.

* **Name**: the name of the parameter.  For example, the ‘Count’ field as is will evaluate to query string ‘count=10’.
* **Value**: static value of the parameter.  Instead of using the value of the ‘Count’ field during evaluation, you can force it to use a static value.  This would look like `[HttpQueryString("count", Value= "10")]`.
* **VariableName**: name of the parameter resolved from settings in the Configuration class.
* **VariableValue**: value of the parameter resolved from settings in the Configuration class.

Now we are ready to test our operation.  By adding `Configuration.SetSetting ("log-VERBOSE", true);` to the beginning of the Start method, you will see copious amounts of information in the Unity Console.

![Calling Instagram Endpoint](https://3160023044-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNwokgSPBJBpAv87dWr%2F-LNwte82ztD31Qc5Z0nJ%2F-LNwvPCz-TtVoFG2pG3h%2Fimage.png?alt=media\&token=ebdd3253-1755-4d2c-9e7f-a98e6844578a)

If you have entered a valid access token you should see these entries in Unity’s Console breaking down the request and responses.

![Request](https://3160023044-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNwokgSPBJBpAv87dWr%2F-LNwte82ztD31Qc5Z0nJ%2F-LNwvWcF7kmt90i0Mrnu%2Fimage.png?alt=media\&token=f7d332d9-64d7-4a6e-9c8b-c6c2f7412750)

![Response](https://3160023044-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNwokgSPBJBpAv87dWr%2F-LNwte82ztD31Qc5Z0nJ%2F-LNwvZo1zbTvCbGSymw7%2Fimage.png?alt=media\&token=8ccc086b-eae6-44fc-8811-e0375f63e6b4)

The returned text is raw JSON and is pretty useless to us at this point.

![Response Data](https://3160023044-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNwokgSPBJBpAv87dWr%2F-LNwte82ztD31Qc5Z0nJ%2F-LNwvdiG-F3WMxu0hDvm%2Fimage.png?alt=media\&token=55e033d5-5d5d-4416-82c3-018c9e30d77f)

In the next post we will take a look on how to make this JSON data accessible to us in Unity.<br>
