Skip to content

One or more errors occurred. (HTTP Response Not OK) using .net core #15

@jadav1982

Description

@jadav1982

Hello,

I have create console application using .net core 3.

Code

        String API_KEY = "my user name";
        String API_SECRET = "my password";
        Boolean HMAC = false;
        MessageMediaMessagesClient client = new MessageMediaMessagesClient(API_KEY, API_SECRET, HMAC);

        MessagesController messages = client.Messages;


        SendMessagesRequest body = new SendMessagesRequest();
        body.Messages = new List<Message>();

        Message body_messages_0 = new Message();
        body_messages_0.Content = "Test SMS from Tarun";
        body_messages_0.DestinationNumber = "+16233266836";
        body.Messages.Add(body_messages_0);

        try
        {
            MessageMedia.Messages.Models.SendMessagesResponse result = messages.SendMessagesAsync(body).Result;
            Console.WriteLine(result);
        }
        catch (APIException e)
        {
            Console.WriteLine(e.Message + e.ResponseCode + e.HttpContext.ToString());
        };

Getting below error

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. (HTTP Response Not OK) Source=System.Private.CoreLib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at ConsoleApp4.Program.Main(String[] args) in C:\Users\Tarun\source\repos\ConsoleApp4\ConsoleApp4\Program.cs:line 45

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
APIException: HTTP Response Not OK
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions