nerosure.blogg.se

Sonarr api
Sonarr api





sonarr api

The calendar for Sonarr and Radarr on the home page of Organizr are blank. Hopefully this is enough to get you started! Share what you build - I’d love to hear about it.Operating System: Windows 10 Problem Description: $query = << sonarr api

This time, we’re just going to build it as an array in PHP.

sonarr api

Next, let’s submit some inputs here - rather than just getting all accounts, I’d like to submit a search object to get back accounts named Peter, like I did in an earlier article with Raphael.įirst, let’s build up the search object in the same manner as we did previously. The top level property is data, followed by the query name of accounts, and then the fields we requested. $decodedResponse = json_decode($response->getBody()->getContents(), false, JSON_PRETTY_PRINT) print_r($decodedResponse) Īs you can see, we get this back in the same format I showed previously using GraphiQL. Let’s see what we get back by decoding the response and just printing it out to the screen. We then submit JSON to the server as a simple object, where the property is query and the value is our query. The two headers to include are an Authorization header where we send the token we created earlier with the prefix Bearer, and we tell the server we want to accept JSON as a response. We’re submitting an HTTP POST to /api/graphql at your Sonar URL. I’ll also add a temporary echo statement so I can make sure it works. In this file, I’m going to include the Composer autoloader to automatically load any packages I install. Now I’m going to create a single PHP file called medium.php to act as my app. Now I can add Guzzle as a dependency by typing composer require guzzlehttp/guzzle. Next, I’m going to setup my simple app by typing composer init. I’m going to use Guzzle as my HTTP client in this case.įirst, let’s install Composer, the de-facto package manager for PHP. All you need is a way to make a HTTP request, and the ability to parse JSON. I’m going to build this in PHP, but the concepts are applicable to almost any language. As a query and a mutation can both take input data, we use a POST to submit to the server, and receive JSON in response. In GraphQL, a query always fetches data and a mutation always manipulates data. GraphQL is a different paradigm to something like REST, where the HTTP verb dictates the behavior. It’s served over HTTPS, and the only HTTP verb you need to use is POST. Using the Sonar GraphQL API in an external application is pretty simple. Now let’s build a very simple application so we can consume the API externally. In the first three articles in this series, I walked you through how to use the API using GraphiQL, a web based tool included in Sonar.







Sonarr api