Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Adding a new topic related to GuzzleHttp library #6859

Merged
merged 8 commits into from
Mar 18, 2020

Conversation

eduard13
Copy link
Contributor

@eduard13 eduard13 commented Mar 13, 2020

Purpose of this pull request

This pull request (PR) adds a new page where it is described how can we easily integrate an API web service in Magento. It's a good replacement of directly using CURL library.

Affected DevDocs pages

N/A

Links to Magento source code

whatsnew
Added a new topic about how to create an integration using the GuzzleHttp external API to use some external Web Services.

@devops-devdocs
Copy link
Collaborator

An admin must run tests on this PR before it can be merged.

Copy link
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @eduard13. Thank you for your contribution. Please, check my comments below for some minor adjustments.

Also, it would be awesome to add some information about why exactly Guzzle is better/preferable than the built-in cURL wrapper and in what cases.

Thank you!

contributor_link: https://www.atwix.com/
---

This tutorial shows you how to create an integration with an external API using [GuzzleHttp](http://docs.guzzlephp.org/en/stable/quickstart.html){:target="_blank"} library, that is included into magento package.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This tutorial shows you how to create an integration with an external API using [GuzzleHttp](http://docs.guzzlephp.org/en/stable/quickstart.html){:target="_blank"} library, that is included into magento package.
This tutorial shows you how to create an integration with an external API using [GuzzleHttp](http://docs.guzzlephp.org/en/stable/quickstart.html){:target="_blank"} library, that is included into Magento package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


## Create a Github API integration

In the following example, we're be using the [Github API](https://api.github.com/) as web service, and will fetch some data regarding the Magento 2 Git repository.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In the following example, we're be using the [Github API](https://api.github.com/) as web service, and will fetch some data regarding the Magento 2 Git repository.
In the following example, we're using the [Github API](https://api.github.com/) as web service, and will fetch some data regarding the Magento 2 Git repository.

/**
* Fetch some data from API
*/
public function execute()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use strict types, it makes sense to define all return types

Suggested change
public function execute()
public function execute(): void

@rogyar
Copy link
Contributor

rogyar commented Mar 14, 2020

Also, please, add another "Whatsnew" section to the PR description with a few sentences about what new info has been added in your PR.

@rogyar rogyar added New Topic A major update published as an entirely new document 2.3.x Magento 2.3 related changes labels Mar 14, 2020
@eduard13
Copy link
Contributor Author

Hi @rogyar, thank you for your suggestions, the topic has been slightly improved. Could you review the last changes, please?

@rogyar
Copy link
Contributor

rogyar commented Mar 15, 2020

Could you doublecheck the "whatsnew" section, please? I'm not sure we are adding info about

Creating an integration with an external API topic

within the scope of the current PR. Also, the link in the "whatsnew" section does not work.

Thank you.

@eduard13
Copy link
Contributor Author

I've just updated the section, regarding the url, I was thinking that we need to provide the url of the new topic (as I've seen on some related PRs).
Thanks.

@rogyar
Copy link
Contributor

rogyar commented Mar 17, 2020

Here is another example of a class that uses Guzzle client from the codebase

https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/HTTP/AsyncClient/GuzzleAsyncClient.php#L18

@dobooth
Copy link
Contributor

dobooth commented Mar 18, 2020

running tests

@dobooth dobooth merged commit 9edc184 into magento:master Mar 18, 2020
@ghost
Copy link

ghost commented Mar 18, 2020

Hi @eduard13, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@eduard13
Copy link
Contributor Author

Hi @dobooth, is there any reason of rewarding this PR only as improvement?
Thank you.

@sidolov sidolov added New Topic A major update published as an entirely new document and removed New Topic A major update published as an entirely new document labels Mar 20, 2020
@eduard13 eduard13 deleted the guzzle-http-page branch February 12, 2021 13:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.3.x Magento 2.3 related changes New Topic A major update published as an entirely new document Partner: Atwix partners-contribution PR created by Magento partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants