{"id":19888901,"url":"https://github.com/paypal/paypalhttp_dotnet","last_synced_at":"2025-07-26T00:10:15.677Z","repository":{"id":39870727,"uuid":"212699282","full_name":"paypal/paypalhttp_dotnet","owner":"paypal","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-23T19:54:21.000Z","size":61,"stargazers_count":5,"open_issues_count":3,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-13T19:27:26.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paypal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-03T23:20:56.000Z","updated_at":"2023-01-16T10:27:20.000Z","dependencies_parsed_at":"2022-09-02T01:20:29.803Z","dependency_job_id":null,"html_url":"https://github.com/paypal/paypalhttp_dotnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypalhttp_dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypalhttp_dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypalhttp_dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypalhttp_dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paypal","download_url":"https://codeload.github.com/paypal/paypalhttp_dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224324455,"owners_count":17292521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T18:08:36.007Z","updated_at":"2025-07-26T00:10:15.659Z","avatar_url":"https://github.com/paypal.png","language":"C#","funding_links":["https://developer.paypal.com/serversdk/http/getting-started/how-to-get-started/"],"categories":[],"sub_categories":[],"readme":"# Deprecation Notice:\nThis SDK is deprecated; you can continue to use it, but no new features or support requests will be accepted. An integration with [the new Server SDK](https://github.com/paypal/PayPal-Server-SDKs) is recommended. Review the [docs](https://developer.paypal.com/serversdk/http/getting-started/how-to-get-started/) for details.\n\n## PayPal HttpClient\n\nPayPalHttp is a generic HTTP Client used with [generated server SDKs](https://github.braintreeps.com/dx/sdkgen).\n\nIn it's simplest form, an [`HttpClient`](./PayPalHttp-Dotnet/HttpClient.cs) exposes an `Execute` method which takes an [HTTP request](./PayPalHttp-Dotnet/HttpRequest.cs), executes it against the domain described in an [Environment](./PayPalHttp-Dotnet/Environment.cs), and returns an [HTTP response](./PayPalHttp-Dotnet/HttpResponse.cs).\n\n### Environment\n\nAn [`Environment`](./PayPalHttp-Dotnet/Environment.cs) describes a domain that hosts a REST API, against which an `HttpClient` will make requests. `Environment` is a simple interface that wraps one method, `BaseUrl`.\n\n```C#\nvar env = new Environment('https://example.com')\n```\n\n### Requests\n\nHTTP requests contain all the information needed to make an HTTP request against the REST API. Specifically, one request describes a path, a method, any path/query/form parameters, headers, attached files for upload, and body data.\n\nThese objects are constructed in code generated by the [sdkgen](http://github.braintreeps.com/dx/sdkgen) project. Instructions for using generated HTTP request subclasses is provided in that project.\n\n### Responses\n\nHTTP responses contain information returned by a server in response to a request as described above. They are simple objects which contain a status code, headers, and any data returned by the server.\n\n```C#\nvar client = new HttpClient(env);\n\nvar request = new HttpRequest(\"/\", HttpMethod.Get);\nrequest.Body = \"some data\";\n\nvar response = await client.Execute(request);\n\nvar statusCode = response.StatusCode;\nvar headers = response.Headers;\nvar data = response.Result\u003cString\u003e();\n```\n\n### Injectors\n\nInjectors are blocks that can be used for executing arbitrary pre-flight logic, such as modifying a request or logging data. Injectors are attached to an `HttpClient` using the `AddInjector` method.\n\nThe `HttpClient` executes its injectors in a first-in, first-out order, before each request.\n\n```C#\nclass LogInjector : IInjector\n{\n\tpublic void Inject(HttpRequest request)\n    {\n        // Do some logging here\n    }\n}\n\nvar logInjector = new LogInjector();\nclient.AddInjector(logInjector);\n...\n```\n\n### Error Handling\n\n`HttpClient#Execute` may throw an `HttpException` if something went wrong during the course of execution. If the server returned a non-200 response, [HttpException](./PayPalHttp-Dotnet/HttpException.cs) will be thrown, that will contain a status code and headers you can use for debugging.\n\n```C#\ntry\n{\n    client.Execute(request);\n}\ncatch (HttpException ex)\n{\n\tvar statusCode = ex.StatusCode;\n\tvar headers = ex.Headers;\n\tvar message = ex.response\u003cString\u003e();\n}\n```\n\n## License\nPayPalHttp-Dotnet is open source and available under the MIT license. See the [LICENSE](./LICENSE) file for more information.\n\n## Contributing\nPull requests and issues are welcome. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fpaypalhttp_dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaypal%2Fpaypalhttp_dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fpaypalhttp_dotnet/lists"}