{"id":39731,"date":"2020-12-21T05:16:23","date_gmt":"2020-12-21T13:16:23","guid":{"rendered":"https:\/\/kinsta.com\/?p=4256"},"modified":"2023-09-05T13:43:42","modified_gmt":"2023-09-05T12:43:42","slug":"wordpress-http-api-teil-2","status":"publish","type":"post","link":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/","title":{"rendered":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress &#8211; Teil 2"},"content":{"rendered":"<p><a href=\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-1\/\">In Teil 1 dieses Guides<\/a> habe ich einen Blick auf die HTTP API im Allgemeinen geworfen. Wir haben gelernt, was HTTP ist, haben \u00fcber die Struktur von HTTP-Anfragen und -Antworten gesprochen und wie Aktionstypen und URLs zusammenkommen, um zu bestimmen, was du im Austausch f\u00fcr deine Anfrage erh\u00e4ltst. In diesem Beitrag werden wir einen Blick auf die WordPress HTTP API werfen.<\/p>\n<ul>\n<li><a href=\"#wordpress-http-api\">Die WordPress HTTP API<\/a><\/li>\n<li><a href=\"#making-requests\">Anfragen stellen<\/a><\/li>\n<li><a href=\"#accessing-github-api\">Zugriff auf die Github API<\/a><\/li>\n<\/ul>\n<h2 id=\"wordpress-http-api\">Die WordPress HTTP API<\/h2>\n<p>Seit etwa Version 2.7 hat <a href=\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api\/\">WordPress eine API f\u00fcr die Handhabung von HTTP<\/a>. Sie besteht aus 9 Funktionen, von denen du wahrscheinlich nur ein paar benutzen wirst. Die Funktionen k\u00f6nnen in zwei verschiedene Gruppen eingeteilt werden &#8211; eine f\u00fcr das Stellen von Anfragen, eine f\u00fcr das Lesen von Ergebnissen.<\/p>\n<p><code>wp_remote_get()<\/code>, <code>wp_remote_post()<\/code>, <code>wp_remote_head()<\/code> verwenden die Methoden GET, POST und HEAD, um Daten von einer bestimmten URL anzufordern. Die Funktion <code>wp_remote_request()<\/code> ist eine allgemeine Funktion, die es dir erlaubt, eine URL und eine dazugeh\u00f6rige Methode anzugeben.<\/p>\n<p>Die Funktionen zum Lesen von Antworten sind \u00e4hnlich selbstbeschreibend. <code>wp_remote_retrieve_body()<\/code> holt den Body der Antwort, die Funktion <code>wp_remote_retrieve_header()<\/code> holt einen benannten Header. Die Funktion <code>wp_remote_retrieve_headers()<\/code> gibt alle Header in Arrayform zur\u00fcck, <code>wp_remote_retrieve_response_code()<\/code> gibt dir den Antwortcode und <code>wp_remote_retrieve_response_message()<\/code> gibt die Antwortnachricht zur\u00fcck.<\/p>\n<p>Das ist im Grunde alles, was wir tun m\u00fcssen, ist herauszufinden, wie wir Header angeben k\u00f6nnen, um richtige Anfragen zu stellen.<\/p>\n<h2 id=\"making-requests\">Anfragen stellen<\/h2>\n<p>Benutzen wir die Funktion <code>wp_remote_get()<\/code>, um eine Anfrage zu stellen. Wir benutzen den ersten Parameter, um die URL zu setzen und den zweiten, um Argumente hinzuzuf\u00fcgen. Du kannst alle unterst\u00fctzten Parameter im <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_remote_get\">Codex<\/a> nachlesen, ich werde mich hier auf die Header-Informationen konzentrieren.<\/p>\n<p>Um die Statusmeldung eines Nutzers von Twitter zu erhalten, musst du den <code>statuses\/user_timeline.json<\/code> Pfad neben der <code>https:\/\/api.twitter.com\/1.1<\/code> URL verwenden und ein Bearer Token zur Authentifizierung \u00fcbergeben &#8211; welches ich zuvor generiert habe. Das \u00dcberbringer-Token muss als Autorisierungs-Header in Form von <code>Bearer [TOKEN]<\/code> hinzugef\u00fcgt werden.<\/p>\n<pre><code>$token = 'Sijbwrf82wdaBief'; \n$response = wp_remote_get('https:\/\/api.twitter.com\/1.1\/statuses\/user_timeline.json?screen_name=kinsta', array(\n    'headers' =&gt; array(\n        'Authorization' =&gt; 'Bearer ' . $token\n    ),\n));<\/code><\/pre>\n<p>Diese Anfrage gibt eine F\u00fclle von Informationen zur\u00fcck, die durch das Ausdrucken der <code>$response<\/code>-Variable abgerufen werden k\u00f6nnen. Du kannst auch die Funktionen vom Typ <code>wp_remote_retrieve<\/code> verwenden, um einen Teil der Antwort zu erhalten.<\/p>\n<p>Meistens enth\u00e4lt der Body die notwendigen Informationen, normalerweise im JSON Format. In PHP k\u00f6nnen wir das mit Leichtigkeit in ein Array umwandeln:<\/p>\n<pre><code>$data = json_decode( $response['body'], true ) <\/code><\/pre>\n<h2 id=\"accessing-github-api\">Zugriff auf die Github API<\/h2>\n<p>Lass uns ein schnelles Beispiel bauen, das unsere neuesten Github Repos in einem WordPress Widget auflistet. Als erstes musst du dich bei Github einloggen und zu deinem Profil gehen, es bearbeiten und zu &#8222;Personal access tokens&#8220; gehen, wo du ein Token generieren kannst.<\/p>\n<figure style=\"width: 763px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/kinsta.com\/wp-content\/uploads\/2015\/08\/Screen-Shot-2015-08-31-at-14.45.52.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2015\/08\/Screen-Shot-2015-08-31-at-14.45.52.png\" alt=\"Github Zugangstoken\" width=\"763\" height=\"252\"><\/a><figcaption class=\"wp-caption-text\">Github Zugangstoken<\/figcaption><\/figure>\n<p>Als n\u00e4chsten Schritt erstellen wir ein leeres Template f\u00fcr ein Widget. Dieses Widget wird zwei Optionen haben: einen Platz, an dem du dein API-Token hinzuf\u00fcgen kannst und einen Titel. Dies ist nicht die beste Methode, da es dein Token in der <a href=\"https:\/\/kinsta.com\/de\/blog\/wordpress-datenbank\/\">Datenbank<\/a> speichert, aber f\u00fcr unser Beispiel reicht es.<\/p>\n<pre><code class=\"language-php\"><span id=\"urn:enhancement-7335a11e\" class=\"textannotation\">class<\/span> My_<span id=\"urn:enhancement-e7d2a391\" class=\"textannotation\">Github<\/span>_<span id=\"urn:enhancement-7769ff57\" class=\"textannotation\">Widget<\/span> extends WP_<span id=\"urn:enhancement-cafef357\" class=\"textannotation\">Widget<\/span> {\n\n\t<span id=\"urn:enhancement-a7c8c7ea\" class=\"textannotation\">public<\/span> <span id=\"urn:enhancement-140bee6e\" class=\"textannotation\">function<\/span> __construct() {\n\t\tparent::__construct(\n\t\t\t'my_github_widget',\n\t\t\t'My <span id=\"urn:enhancement-4fb3b20b\" class=\"textannotation\">Github<\/span> Repos',\n\t\t\tarray( '<span id=\"urn:enhancement-99075137\" class=\"textannotation\">description<\/span>' =&gt; 'A widget that showcases your <span id=\"urn:enhancement-3e8c05fe\" class=\"textannotation\">Github<\/span> repos' )\n\t\t);\n\t}\n\n\t<span id=\"urn:enhancement-4c06ebd5\" class=\"textannotation\">public<\/span> <span id=\"urn:enhancement-87b04bc4\" class=\"textannotation\">function<\/span> widget( $<span id=\"urn:enhancement-1b29eba4\" class=\"textannotation\">args<\/span>, $<span id=\"urn:enhancement-35842ef7\" class=\"textannotation\">instance<\/span> ) {\n\t\t\/\/ <span id=\"urn:enhancement-45bad6a1\" class=\"textannotation\">Widget<\/span> output\n\t}\n\n\t<span id=\"urn:enhancement-6ce7db32\" class=\"textannotation\">public<\/span> <span id=\"urn:enhancement-fded4104\" class=\"textannotation\">function<\/span> form( $<span id=\"urn:enhancement-7b83c5e2\" class=\"textannotation\">instance<\/span> ) {\n\t\t$token = ! <span id=\"urn:enhancement-64c373f\" class=\"textannotation\">empty<\/span>( $<span id=\"urn:enhancement-99da1065\" class=\"textannotation\">instance<\/span>['token'] ) ? $<span id=\"urn:enhancement-e0ef0985\" class=\"textannotation\">instance<\/span>['token'] : '';\n\t\t$<span id=\"urn:enhancement-5344a301\" class=\"textannotation\">title<\/span> = ! <span id=\"urn:enhancement-a785eb2c\" class=\"textannotation\">empty<\/span>( $<span id=\"urn:enhancement-91c3a765\" class=\"textannotation\">instance<\/span>['title'] ) ? $<span id=\"urn:enhancement-6c4e5bdf\" class=\"textannotation\">instance<\/span>['title'] : 'From <span id=\"urn:enhancement-8d0e05c4\" class=\"textannotation\">Github<\/span>';\n\t\t?&gt;<\/code><\/pre>\n<pre><code>&lt;<span id=\"urn:enhancement-db0be4c9\" class=\"textannotation\">label<\/span> for=\"get_<span id=\"urn:enhancement-ff60a08d\" class=\"textannotation\">field<\/span>_id( '<span id=\"urn:enhancement-8eea95ef\" class=\"textannotation\">title<\/span>' ); ?&gt;\"&gt;Title &lt;input <span id=\"urn:enhancement-c5c24d63\" class=\"textannotation\">class<\/span>=\"widefat\" id=\"get_<span id=\"urn:enhancement-205870ba\" class=\"textannotation\">field<\/span>_id( '<span id=\"urn:enhancement-a998d4e2\" class=\"textannotation\">title<\/span>' ); ?&gt;\" name=\"get_<span id=\"urn:enhancement-3ea1fb67\" class=\"textannotation\">field<\/span>_name( '<span id=\"urn:enhancement-fc1202aa\" class=\"textannotation\">title<\/span>' ); ?&gt;\" type=\"text\" <span id=\"urn:enhancement-500ea62\" class=\"textannotation\">value<\/span>=\"\"&gt;\n\n&lt;<span id=\"urn:enhancement-966e761d\" class=\"textannotation\">label<\/span> for=\"get_<span id=\"urn:enhancement-5a7f6711\" class=\"textannotation\">field<\/span>_id( 'token' ); ?&gt;\"&gt;<span id=\"urn:enhancement-8b60ea21\" class=\"textannotation\">Github<\/span> <span id=\"urn:enhancement-a7c123bc\" class=\"textannotation\">API<\/span> <span id=\"urn:enhancement-9f307854\" class=\"textannotation\">Token<\/span> &lt;input <span id=\"urn:enhancement-8037eee\" class=\"textannotation\">class<\/span>=\"widefat\" id=\"get_<span id=\"urn:enhancement-6046abc2\" class=\"textannotation\">field<\/span>_id( 'token' ); ?&gt;\" name=\"get_<span id=\"urn:enhancement-5e1ab086\" class=\"textannotation\">field<\/span>_name( 'token' ); ?&gt;\" type=\"text\" <span id=\"urn:enhancement-702d9deb\" class=\"textannotation\">value<\/span>=\"\"&gt;\n\n&lt;?php } }<\/code><\/pre>\n<p>Ich m\u00f6chte hier nicht zu sehr darauf eingehen, wie Widgets erstellt werden. Wenn du mehr wissen willst, schau dir den <a href=\"https:\/\/codex.wordpress.org\/Widgets_API\">Widgets API<\/a> Guide im Codex an. Das Wichtigste ist, dass der Inhalt der <code>widget()<\/code>-Methode den Inhalt unseres Widgets ausgeben wird. Innerhalb dieser Funktion verbinden wir uns mit Github \u00fcber eine HTTP-Anfrage und formatieren und geben die Antwort aus. Der folgende Code wird in die <code>widget()<\/code>-Methode eingef\u00fcgt.<\/p>\n<pre><code class=\"language-php\">echo $<span id=\"urn:enhancement-bcf03c5b\" class=\"textannotation\">args<\/span>['before_widget']; \n\nif ( ! empty( $<span id=\"urn:enhancement-c5df6f5c\" class=\"textannotation\">instance<\/span>['title'] ) ) { \n  echo $<span id=\"urn:enhancement-d7b4142a\" class=\"textannotation\">args<\/span>['before_title'] . apply_<span id=\"urn:enhancement-f0f5b179\" class=\"textannotation\">filters<\/span>( 'widget_title', $<span id=\"urn:enhancement-5afdf4c6\" class=\"textannotation\">instance<\/span>['title'] ). $<span id=\"urn:enhancement-288763e\" class=\"textannotation\">args<\/span>['after_title']; \n} \n\n$<span id=\"urn:enhancement-88b6ca0a\" class=\"textannotation\">args<\/span> = <span id=\"urn:enhancement-7c5b3f30\" class=\"textannotation\">array<\/span>( \n  'headers' =&gt; <span id=\"urn:enhancement-733ce241\" class=\"textannotation\">array<\/span>( \n    '<span id=\"urn:enhancement-8c1121b5\" class=\"textannotation\">Accept<\/span>' =&gt; '<span id=\"urn:enhancement-1b18e4b\" class=\"textannotation\">application<\/span>\/vnd.github.v3+json', \n    '<span id=\"urn:enhancement-4c7f4130\" class=\"textannotation\">Authorization<\/span>' =&gt; 'token 3f4f654ab31c2f15e839c74c952e5de2f562f1ee' \n  ) \n); \n\n$response = wp_remote_get( 'https:\/\/api.github.com\/user\/repos', $<span id=\"urn:enhancement-e002d8d1\" class=\"textannotation\">args<\/span> ); \n$repos = json_decode( $response['body'], true ); \n\nif( !empty( $repos ) ) { \n  echo '&lt;ul&gt;'; \n  <span id=\"urn:enhancement-307b890d\" class=\"textannotation\">foreach<\/span>( $repos as $repo ) { \n    echo '&lt;li&gt;&lt;a <span id=\"urn:enhancement-2c655989\" class=\"textannotation\">href=<\/span>\"' . $repo['url'] . '\" <span id=\"urn:enhancement-96ba4154\" class=\"textannotation\">target<\/span>=\"_blank\"&gt;' . $repo['name'] . '&lt;\/a&gt;&lt;\/<span id=\"urn:enhancement-cb68e685\" class=\"textannotation\">li<\/span>&gt;'; \n  } \n  echo '&lt;\/ul&gt;'; \n} \n\necho $<span id=\"urn:enhancement-e10554ba\" class=\"textannotation\">args<\/span>['after_widget'];<\/code><\/pre>\n<p>Es beginnt damit, dass ich einfach das Wrapper-Element und den Titel des Widgets oben hinzuf\u00fcge und endet damit, dass ich den Wrapper des Widgets schlie\u00dfe, der Hauptteil des Codes befindet sich zwischen den beiden.<\/p>\n<p>Zuerst richte ich meine HTTP-Request-Header ein. Die erste Frage ist vielleicht: Woher wei\u00df ich, welche Parameter ich hinzuf\u00fcgen muss? Der <code>Authorization<\/code> Header ist das Wichtigste, das habe ich im Abschnitt <a href=\"https:\/\/developer.github.com\/v3\/#authentication\">Authentication<\/a> in den API Docs gelesen.<\/p>\n<p>Der <code>Accept<\/code>-Header ist nicht erforderlich, aber oben auf der gleichen Doku-Seite wird dazu ermutigt, diesen anzugeben.<\/p>\n<p>Ich verwende dann <code>json_decode()<\/code> auf den Body der Antwort und gehe einfach durch das resultierende Array, um eine Liste von Links zu erstellen.<\/p>\n<h2>N\u00e4chste Schritte<\/h2>\n<p>Wenn du denkst, dass das einfach war, hast du vollkommen recht, das ist es! Der schwierige Teil ist sicherzustellen, dass du alle Winkel abdeckst, ohne Ressourcen zu verschwenden. Es gibt zwei Probleme mit dem Code, die unsere sofortige Aufmerksamkeit erfordern w\u00fcrden.<\/p>\n<p>Wenn es ein Problem mit der API gibt &#8211; was unbekannte Fehler, ratenbeschr\u00e4nkte Konten und so weiter einschlie\u00dfen kann &#8211; k\u00f6nnten wir auf einen gro\u00dfen Fehler sto\u00dfen. Wir \u00fcberpr\u00fcfen nur, ob der Body leer ist oder nicht, bevor wir die Liste anzeigen.<\/p>\n<p>Wenn wir auf einen Fehler sto\u00dfen, wird der Body wahrscheinlich Fehlerinformationen enthalten, also w\u00e4re er auch in diesem Fall nicht leer. Es ist wahrscheinlich, dass wir die Elemente der Fehlerantwort auflisten w\u00fcrden, aber da diese keine <code>url<\/code> und <code>name<\/code> Eigenschaften h\u00e4tten, w\u00fcrden wir mit leeren Listenelementen und PHP Warnungen enden.<\/p>\n<p>Das zweite Problem ist, dass dies einfach verschwenderisch ist. Wir verbinden uns bei jedem Seitenaufruf mit einem externen Dienst, was unsere Server belastet und dazu f\u00fchren kann, dass der Account auf Github limitiert wird. Selbst wenn dies nicht der Fall ist, wie wahrscheinlich ist es, dass sich deine Github Repo-Liste zwischen zwei Seitenaufrufen \u00e4ndert und wie wichtig ist es, hier sekundengenaue Informationen zu haben?<\/p>\n<p>Ich pers\u00f6nlich w\u00fcrde in einem Fall wie diesem empfehlen, Transients zu verwenden. Ein <a href=\"https:\/\/codex.wordpress.org\/Transients_API\">Transient<\/a> erlaubt es dir, die Antwort der Anfrage mit einer Verfallszeit zu speichern. Wenn du die Verfallszeit auf einen Tag setzt, werden die Daten einmal von Github abgerufen, dann direkt von deiner Datenbank f\u00fcr die n\u00e4chsten 24 Stunden. Nach Ablauf werden es wieder von Github abgerufen und in der Datenbank gespeichert.<\/p>\n<p>Das reduziert deine API-Aufrufe von einem pro Seitenaufruf auf einen pro Tag, was eine gro\u00dfe Verbesserung ist und auch kein gro\u00dfer Nachteil.<\/p>\n<h2>Zusammenfassung<\/h2>\n<p>WordPress macht es einfach, mit APIs aus dem ganzen Web zu interagieren. Mit ein paar eingebauten Funktionen kannst du reichhaltigere und relevantere Daten f\u00fcr deine Nutzer einholen.<\/p>\n<p>Gepaart mit Sanitization, Error Checking und einem Caching-Mechanismus kannst du eine effiziente Anwendung erstellen, die nicht nur n\u00fctzlicher ist, sondern auch weniger Ressourcen verbraucht, als du vielleicht denkst.<\/p>\n<p>Wenn du die WordPress HTTP API benutzt hast, um WordPress mit einer API eines Drittanbieters zu verbinden, lass es uns wissen, es w\u00e4re toll von deiner Arbeit zu h\u00f6ren!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I&#8217;ll take a look at how you can handle HTTP requests easily with the help of the WordPress HTTP API. We&#8217;ll also be looking at a simple example using Github&#8217;s API, if you want to follow along, grab a free account!<\/p>\n","protected":false},"author":18,"featured_media":39736,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[351,29],"topic":[999],"class_list":["post-39731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-api","tag-wordpress","topic-wordpress-entwicklung"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2<\/title>\n<meta name=\"description\" content=\"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2\" \/>\n<meta property=\"og:description\" content=\"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Deutschland-207459890108303\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-21T13:16:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-05T12:43:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Daniel Pataki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@danielpataki\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_DE\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Pataki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"7\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\"},\"author\":{\"name\":\"Daniel Pataki\",\"@id\":\"https:\/\/kinsta.com\/de\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\"},\"headline\":\"Ein Leitfaden zu HTTP und der HTTP-API von WordPress &#8211; Teil 2\",\"datePublished\":\"2020-12-21T13:16:23+00:00\",\"dateModified\":\"2023-09-05T12:43:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\"},\"wordCount\":1056,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/de\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\",\"keywords\":[\"API\",\"WordPress\"],\"articleSection\":[\"WordPress Entwicklung\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\",\"url\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\",\"name\":\"Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/de\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\",\"datePublished\":\"2020-12-21T13:16:23+00:00\",\"dateModified\":\"2023-09-05T12:43:42+00:00\",\"description\":\"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\",\"contentUrl\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg\",\"width\":800,\"height\":500,\"caption\":\"wordpress http api\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Entwicklung\",\"item\":\"https:\/\/kinsta.com\/de\/thema\/wordpress-entwicklung\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ein Leitfaden zu HTTP und der HTTP-API von WordPress &#8211; Teil 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/de\/#website\",\"url\":\"https:\/\/kinsta.com\/de\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"Schnelle, sichere und hochwertige Hosting-L\u00f6sungen\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/de\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/de\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/de\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinsta.com\/de\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/kinsta.com\/de\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/de\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Deutschland-207459890108303\/\",\"https:\/\/x.com\/Kinsta_DE\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/de\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\",\"name\":\"Daniel Pataki\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/kinsta.com\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"caption\":\"Daniel Pataki\"},\"description\":\"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.\",\"sameAs\":[\"http:\/\/danielpataki.com\",\"https:\/\/x.com\/danielpataki\"],\"url\":\"https:\/\/kinsta.com\/de\/blog\/author\/danielpataki\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2","description":"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/","og_locale":"de_DE","og_type":"article","og_title":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2","og_description":"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!","og_url":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Deutschland-207459890108303\/","article_published_time":"2020-12-21T13:16:23+00:00","article_modified_time":"2023-09-05T12:43:42+00:00","og_image":[{"width":800,"height":500,"url":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","type":"image\/jpeg"}],"author":"Daniel Pataki","twitter_card":"summary_large_image","twitter_description":"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!","twitter_image":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","twitter_creator":"@danielpataki","twitter_site":"@Kinsta_DE","twitter_misc":{"Verfasst von":"Daniel Pataki","Gesch\u00e4tzte Lesezeit":"7\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/"},"author":{"name":"Daniel Pataki","@id":"https:\/\/kinsta.com\/de\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff"},"headline":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress &#8211; Teil 2","datePublished":"2020-12-21T13:16:23+00:00","dateModified":"2023-09-05T12:43:42+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/"},"wordCount":1056,"commentCount":0,"publisher":{"@id":"https:\/\/kinsta.com\/de\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","keywords":["API","WordPress"],"articleSection":["WordPress Entwicklung"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/","url":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/","name":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress - Teil 2","isPartOf":{"@id":"https:\/\/kinsta.com\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","datePublished":"2020-12-21T13:16:23+00:00","dateModified":"2023-09-05T12:43:42+00:00","description":"Die WordPress HTTP API erm\u00f6glicht es uns, uns mit APIs von Drittanbietern wie Twitter, Facebook, Mailchimp und mehr zu verbinden. Lies weiter, um zu erfahren wie!","breadcrumb":{"@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#primaryimage","url":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","contentUrl":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2020\/12\/wordpress-http-api.jpg","width":800,"height":500,"caption":"wordpress http api"},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/de\/blog\/wordpress-http-api-teil-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/de\/"},{"@type":"ListItem","position":2,"name":"WordPress Entwicklung","item":"https:\/\/kinsta.com\/de\/thema\/wordpress-entwicklung\/"},{"@type":"ListItem","position":3,"name":"Ein Leitfaden zu HTTP und der HTTP-API von WordPress &#8211; Teil 2"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/de\/#website","url":"https:\/\/kinsta.com\/de\/","name":"Kinsta\u00ae","description":"Schnelle, sichere und hochwertige Hosting-L\u00f6sungen","publisher":{"@id":"https:\/\/kinsta.com\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/de\/#organization","name":"Kinsta","url":"https:\/\/kinsta.com\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/kinsta.com\/de\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/de\/wp-content\/uploads\/sites\/5\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Deutschland-207459890108303\/","https:\/\/x.com\/Kinsta_DE","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinsta.com\/de\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff","name":"Daniel Pataki","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/kinsta.com\/de\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","caption":"Daniel Pataki"},"description":"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.","sameAs":["http:\/\/danielpataki.com","https:\/\/x.com\/danielpataki"],"url":"https:\/\/kinsta.com\/de\/blog\/author\/danielpataki\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/posts\/39731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/comments?post=39731"}],"version-history":[{"count":4,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/posts\/39731\/revisions"}],"predecessor-version":[{"id":39749,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/posts\/39731\/revisions\/39749"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/en"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/de"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/it"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/es"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/pt"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/translations\/fr"},{"href":"https:\/\/kinsta.com\/de\/wp-json\/kinsta\/v1\/posts\/39731\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/media\/39736"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/media?parent=39731"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/tags?post=39731"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/de\/wp-json\/wp\/v2\/topic?post=39731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}