Common REST API Error Codes

by Admin 17. January 2017 01:03

The error codes listed in the following table may be returned by an operation on any of the storage services.

Error codeHTTP status codeUser message
ConditionNotMet Not Modified (304) The condition specified in the conditional header(s) was not met for a read operation.
MissingRequiredHeader Bad Request (400) A required HTTP header was not specified.
MissingRequiredXmlNode Bad Request (400) A required XML node was not specified in the request body.
UnsupportedHeader Bad Request (400) One of the HTTP headers specified in the request is not supported.
UnsupportedXmlNode Bad Request (400) One of the XML nodes specified in the request body is not supported.
InvalidHeaderValue Bad Request (400) The value provided for one of the HTTP headers was not in the correct format.
InvalidXmlNodeValue Bad Request (400) The value provided for one of the XML nodes in the request body was not in the correct format.
MissingRequiredQueryParameter Bad Request (400) A required query parameter was not specified for this request.
UnsupportedQueryParameter Bad Request (400) One of the query parameters specified in the request URI is not supported.
InvalidQueryParameterValue Bad Request (400) An invalid value was specified for one of the query parameters in the request URI.
OutOfRangeQueryParameterValue Bad Request (400) A query parameter specified in the request URI is outside the permissible range.
RequestUrlFailedToParse Bad Request (400) The url in the request could not be parsed.
InvalidUri Bad Request (400) The requested URI does not represent any resource on the server.
InvalidHttpVerb Bad Request (400) The HTTP verb specified was not recognized by the server.
EmptyMetadataKey Bad Request (400) The key for one of the metadata key-value pairs is empty.
InvalidXmlDocument Bad Request (400) The specified XML is not syntactically valid.
Md5Mismatch Bad Request (400) The MD5 value specified in the request did not match the MD5 value calculated by the server.
InvalidMd5 Bad Request (400) The MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded.
OutOfRangeInput Bad Request (400) One of the request inputs is out of range.
InvalidAuthenticationInfo Bad Request (400) The authentication information was not provided in the correct format. Verify the value of Authorization header.
InvalidInput Bad Request (400) One of the request inputs is not valid.
InvalidMetadata Bad Request (400) The specified metadata is invalid. It includes characters that are not permitted.
InvalidResourceName Bad Request (400) The specifed resource name contains invalid characters.
MetadataTooLarge Bad Request (400) The size of the specified metadata exceeds the maximum size permitted.
ConditionHeadersNotSupported BadRequest (400) Condition headers are not supported.
MultipleConditionHeadersNotSupported Bad Request (400) Multiple condition headers are not supported.
AuthenticationFailed Forbidden (403) Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
InsufficientAccountPermissions Forbidden (403) Read operations are currently disabled.
InsufficientAccountPermissions Forbidden (403) Write operations are not allowed.
ResourceNotFound Not Found (404) The specified resource does not exist.
AccountIsDisabled Forbidden (403) The specified account is disabled.
InsufficientAccountPermissions Forbidden (403) The account being accessed does not have sufficient permissions to execute this operation.
UnsupportedHttpVerb Method Not Allowed (405) The resource doesn't support the specified HTTP verb.
AccountAlreadyExists Conflict (409) The specified account already exists.
AccountBeingCreated Conflict (409) The specified account is in the process of being created.
ResourceAlreadyExists Conflict (409) The specified resource already exists.
ResourceTypeMismatch Conflict (409) The specified resource type does not match the type of the existing resource.
MissingContentLengthHeader Length Required (411) The Content-Length header was not specified.
ConditionNotMet Precondition Failed (412) The condition specified in the conditional header(s) was not met for a write operation.
RequestBodyTooLarge Request Entity Too Large (413) The size of the request body exceeds the maximum size permitted.
InvalidRange Requested Range Not Satisfiable (416) The range specified is invalid for the current size of the resource.
InternalError Internal Server Error (500) The server encountered an internal error. Please retry the request.
OperationTimedOut Internal Server Error (500) The operation could not be completed within the permitted time.
ServerBusy Service Unavailable (503) The server is currently unable to receive requests. Please retry your request.

https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/common-rest-api-error-codes

Tags:

Common REST API Error Codes

by Admin 3. January 2017 01:03

The error codes listed in the following table may be returned by an operation on any of the storage services.

Error codeHTTP status codeUser message
ConditionNotMet Not Modified (304) The condition specified in the conditional header(s) was not met for a read operation.
MissingRequiredHeader Bad Request (400) A required HTTP header was not specified.
MissingRequiredXmlNode Bad Request (400) A required XML node was not specified in the request body.
UnsupportedHeader Bad Request (400) One of the HTTP headers specified in the request is not supported.
UnsupportedXmlNode Bad Request (400) One of the XML nodes specified in the request body is not supported.
InvalidHeaderValue Bad Request (400) The value provided for one of the HTTP headers was not in the correct format.
InvalidXmlNodeValue Bad Request (400) The value provided for one of the XML nodes in the request body was not in the correct format.
MissingRequiredQueryParameter Bad Request (400) A required query parameter was not specified for this request.
UnsupportedQueryParameter Bad Request (400) One of the query parameters specified in the request URI is not supported.
InvalidQueryParameterValue Bad Request (400) An invalid value was specified for one of the query parameters in the request URI.
OutOfRangeQueryParameterValue Bad Request (400) A query parameter specified in the request URI is outside the permissible range.
RequestUrlFailedToParse Bad Request (400) The url in the request could not be parsed.
InvalidUri Bad Request (400) The requested URI does not represent any resource on the server.
InvalidHttpVerb Bad Request (400) The HTTP verb specified was not recognized by the server.
EmptyMetadataKey Bad Request (400) The key for one of the metadata key-value pairs is empty.
InvalidXmlDocument Bad Request (400) The specified XML is not syntactically valid.
Md5Mismatch Bad Request (400) The MD5 value specified in the request did not match the MD5 value calculated by the server.
InvalidMd5 Bad Request (400) The MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded.
OutOfRangeInput Bad Request (400) One of the request inputs is out of range.
InvalidAuthenticationInfo Bad Request (400) The authentication information was not provided in the correct format. Verify the value of Authorization header.
InvalidInput Bad Request (400) One of the request inputs is not valid.
InvalidMetadata Bad Request (400) The specified metadata is invalid. It includes characters that are not permitted.
InvalidResourceName Bad Request (400) The specifed resource name contains invalid characters.
MetadataTooLarge Bad Request (400) The size of the specified metadata exceeds the maximum size permitted.
ConditionHeadersNotSupported BadRequest (400) Condition headers are not supported.
MultipleConditionHeadersNotSupported Bad Request (400) Multiple condition headers are not supported.
AuthenticationFailed Forbidden (403) Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
InsufficientAccountPermissions Forbidden (403) Read operations are currently disabled.
InsufficientAccountPermissions Forbidden (403) Write operations are not allowed.
ResourceNotFound Not Found (404) The specified resource does not exist.
AccountIsDisabled Forbidden (403) The specified account is disabled.
InsufficientAccountPermissions Forbidden (403) The account being accessed does not have sufficient permissions to execute this operation.
UnsupportedHttpVerb Method Not Allowed (405) The resource doesn't support the specified HTTP verb.
AccountAlreadyExists Conflict (409) The specified account already exists.
AccountBeingCreated Conflict (409) The specified account is in the process of being created.
ResourceAlreadyExists Conflict (409) The specified resource already exists.
ResourceTypeMismatch Conflict (409) The specified resource type does not match the type of the existing resource.
MissingContentLengthHeader Length Required (411) The Content-Length header was not specified.
ConditionNotMet Precondition Failed (412) The condition specified in the conditional header(s) was not met for a write operation.
RequestBodyTooLarge Request Entity Too Large (413) The size of the request body exceeds the maximum size permitted.
InvalidRange Requested Range Not Satisfiable (416) The range specified is invalid for the current size of the resource.
InternalError Internal Server Error (500) The server encountered an internal error. Please retry the request.
OperationTimedOut Internal Server Error (500) The operation could not be completed within the permitted time.
ServerBusy Service Unavailable (503) The server is currently unable to receive requests. Please retry your request.

https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/common-rest-api-error-codes

Tags:

Angular CLI shortcuts

by Admin 16. September 2016 03:06

 

Angular CLI shortcuts
To install Angular CLI, run: $ npm install -g angular-cli

Generate a my-sample application: $ ng new my-sample


# Generate a new component
$ ng generate component my-new-component

# Generate a new directive
$ ng generate directive my-new-directive

# Generate a new pipe
$ ng generate pipe my-new-pipe

# Generate a new service
$ ng generate service my-new-service

# Generate a new class
$ ng generate class my-new-class

# Generate a new interface
$ ng generate interface my-new-interface

# Generate a new enum
$ ng generate enum my-new-enum

Tags:

Angular2 stuff

by Admin 6. September 2016 07:23

 

The * before the ngFor denotes the fact that *ngFor is what is called a structural directive, a directive that is going to affect the DOM in some way adding or removing elements to it.

 

Backtick (`) are used to define the new ES6 template strings. They are a new great feature of ES6 that let’s you write multiline strings natively and insert any expression directly within a string with a very straightforward syntax.

 

Why don’t we use the Injectable decorator in components? 

Well that’s because the Component decorator enables dependency injection directly.

 

Angular 2 has support for these data-bindings:

1. Interpolation: One-way data binding from the component to the template. Let’s you display information from the component into the template. Example: {{user.name}}.

2. Property bindings: One-way data binding from the component to the template. Let’s you bind data from the component into the template. Example: [src]="user.imageUrl".

3. Event bindings: One-way data binding from the template to the component. Let’s you bind template events to the component. Example [click)="selectuser(user)".

4. [(ngModel)]: Two-way data binding from the component to the template and vice versa. Example [(ngModel)]="user.name".

Tags:

VS 2015 Error Install-Package : Unable to load the service index for source https://api.nuget.org/v3/index.json

by Admin 8. May 2016 07:56

Visual Studio 2015 Error Install-Package : Unable to load the service index for source https://api.nuget.org/v3/index.json

Fix : 

1. Close your Visual Studio 2015

2. Navigate to %AppData%\NuGet\ folder 

3. Delete the NuGet.config file

4. Now open Visual Studio. You can notice that a new NuGet.Config file is generated

This fixes the issue

Tags:

RenderPartialViewToString / Return multiple partial views in JSON - MVC6

by Admin 5. May 2016 00:00

I got a situation where we need to dynamically render multiple partial views and bid on the view in MVC6

So Here is the solution.

This is the common method for rendering the partial views as strings

protected string RenderPartialViewToString(string viewName, object model)

        {

            if (string.IsNullOrEmpty(viewName))

                viewName = ActionContext.ActionDescriptor.Name;

 

            ViewData.Model = model;

 

            using (var sw = new StringWriter())

            {

                var engine = Resolver.GetService(typeof(ICompositeViewEngine))

                    as ICompositeViewEngine;

                var viewResult = engine.FindPartialView(ActionContext, viewName);

 

                var viewContext = new ViewContext(

                    ActionContext,

                    viewResult.View,

                    ViewData,

                    TempData,

                    sw,

                    new HtmlHelperOptions()

                );

                //Everything is async now!

                var t = viewResult.View.RenderAsync(viewContext);

                t.Wait();

                return sw.GetStringBuilder().ToString();

            }

        }

 

Here is the method for the view which returns multiple partial view results as JSON

public async Task<ActionResult> GetMultiplePartialsAsync(Your input parameters go here)

        {

            var viewModel = await _myService.FetchDatasAsync(Your input parameters go here);

   //For brevity I am assigning the same view model to all the partial views.

   //You can have sub models in the view model too

                var json = Json(new

                {

                    FilterPartialViewHtml = RenderPartialViewToString("PagedResults", viewModel),

                    CountriesPartialViewHtml = RenderPartialViewToString("Countries", viewModel),

                    NamesPartialViewHtml = RenderPartialViewToString("Names", viewModel)

                });

                return json;

 

        }

 

Here is my View which load all the 3 partial views on load & on click of a checkbox

Note that the paritals are loaded on load as well as gets reladed on all onchange events of the checkbox for countries & Names

@model ResultViewModel

@{

    Layout = "~/Views/Shared/_DemoLayout.cshtml";

}

<div id="wrapper">

    <main id="content" role="main">

            

            <div class="filtering">

                <div class="filter-form">

                    <div class="inner-block">

                        <form method="get" action="Filter">

                            <div class="filter text-filter">

                                <label class="legend" for="finder-keyword-search">Search</label>

                                <input value="" type="text" name="Keywords" id="Keywords" aria-controls="js-search-results-info" class="text">

                            </div>

                            <div id="divCenturies">

                            </div>

                            <div id="divLastNames">

                            </div>

                        </form>

                    </div>

                </div>

                <div class="js-live-search-results-block">

                    <div class="filtered-results">

                            <div id="searchResults">

                            </div>

                            

                    </div>

                </div>

            </div>

    </main>

</div>

<script>

    var url = '@Url.Action("GetMultiplePartialsAsync", "Search")';

 

    $(window).load(function () {

        SearchData();

        $('#searchResults').hide();

    });

 

    $(document).ready(function () {

        $('#searchResults').hide();

        $('#divCenturies').hide();

        $('#divLastNames').hide();

        $(document).on("change", "input[type=checkbox]", function () {

            SearchData();

        });

 

        $("#Keywords").change(function () {

            SearchData();

        });

        $("#Keywords").keypress(function (e) {

            if ((e.keyCode || e.which) == 13) {

                e.preventDefault();

                SearchData();

            }

        });

    });

 

    function SearchData() {

        $.get(url, { Your input parameters here },

                function (data) {

                    $("#searchResults").html(data.FilterPartialViewHtml);

                    $("#divCenturies").html(data.CountriesPartialViewHtml);

                    $("#divLastNames").html(data.NamesPartialViewHtml);

                });

        $('#searchResults').show();

        $('#divCenturies').show();

        $('#divLastNames').show();

    }

</script>

 

Tags:

.NET core features

by Admin 7. April 2016 02:26

 

.NET core

DNX – Dot Net Execution Environment

Native process for hosting the CLR (dnx.exe)

Includes compiler and xpat tools for building .NET apps

Xpat/ OSS friendly project system (project.json)

Package based (install, restore, pack)

Side by side versioning (Manage DNX’s with the .Net Version Manager (DNVM)

Rosyln compiler  

Tags:

Angular2 Stuff

by Admin 1. April 2016 02:13


Angular2 Style guide 

https://angular.io/styleguide

IDE to use

Visual studio code

https://code.visualstudio.com/docs/introvideos/overview

Other Nice Editors 

1. Atom: https://atom.io/ (Free editor, created by the Github guys. Allows you to add plugins and change appearance with third-party packages)

2. Sublime: https://www.sublimetext.com/ (very modular. Allows you to add plugins and change appearance with third-party packages.)

TypeScript

TypeScript is the language of choice for Angular 2 development. It’s a superset to JavaScript which gets compiled into plain JavaScript. The main feature it

adds are the Types, which make development easier (autocompletion etc.) and less error-prone (compiler errors).

Visual studio code nice intro videos which has got Typescript debugging

https://code.visualstudio.com/docs/introvideos/overview?utm_expid=101350005-29.Dor1By5yTmynP2dmCMGGtw.1&start=true

Tags:

Autofac Dependency Injection in ASP.NET 5

by Admin 21. March 2016 11:50

A. Add the following Autofac reference in the project.json file

                        "Autofac.Extensions.DependencyInjection": "4.0.0-rc1-177"

               Note: the version number might change based on the new releases

B. Introduce the following changes in the Startup.CS file

1. Change the method return type from Void to IServiceProvider like this

                         public IServiceProvider ConfigureServices(IServiceCollection services)

2. Add the following line items after  // Add application services.

            //Autofac DI 

            var builder = new ContainerBuilder();

            //builder.RegisterModule<DataModule>();

            builder.RegisterType<TestService>().As<ITestService>().InstancePerDependency();   // This is a test class and interface I have added on to the              project.

            builder.Populate(services);

            var container = builder.Build();

            return container.Resolve<IServiceProvider>();

3. Usage is quite straight forward as in previous versions

   I have tried implementing in the HomeController.

private readonly ITestService _testService;

        public HomeController(ITestService testService)

        {

            _testService = testService;

        }

        public IActionResult Index()

        {

            ViewData["temp"] = _testService.GetTestString();

            return View();

        }

Thats it!         

 

 

Tags:

Resharper keyboard shortcuts not working in VS2015

by Admin 18. March 2016 11:00

I had an issue earlier with Resharper shortcuts not working in Visual Studio 2015.

I had to follow to use these steps to make Resharper work again

1. Tools > Options > Keyboard > Click on the Reset button (top right) and click ok.

2. Tools > Options > Resharper > Options > Click on Apply Scheme and click Save.

Now close and re-open your visual studio. Hope the Reharper shortcuts are back to life again!

Ctrl + T :)

Tags:

TextBox

Tag cloud