Retry Failed Requests

Learn how to retry failed requests with Bellatrix API attributes.

Example

[TestMethod]
public void AssertJsonSchema()
{
    var request = new RestRequest("api/Albums/10");

    var response = App.GetApiClientService().Get<Albums>(request);

    // http://json-schema.org/examples.html
    var expectedSchema = @"{
                            ""title"": ""Albums"",
                            ""type"": ""object"",
                            ""properties"": {
                                        ""albumId"": {
                                            ""type"": ""integer""
                                        },
                                ""title"": {
                                            ""type"": ""string""
                                },
                                ""artistId"": {
                                            ""type"": ""integer""
                                },
                          ""artist"": {
                                            ""type"": ""object""
                                },
                         ""tracks"": {
                                            ""type"": ""object""
                                }
                                    },
                            ""required"": [""albumId""]
                          }";

    response.AssertSchema(expectedSchema);
}
}

Explanations

response.AssertSchema(expectedSchema);

Use the Bellatrix AssertSchema method to validate the schema. The same method can be used for XML responses as well.