Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.
/ ftapi-scripts Public archive

Scripts to interact with the 42 Intra's API

Notifications You must be signed in to change notification settings

mehdibo/ftapi-scripts

Repository files navigation

FtApi Scripts

A set of scripts to get data from 42's API

Getting started

Install composer

This library uses Composer to manage its dependencies, so Install Composer.

Install dependencies

cd to the project's folder and run:

composer install

Configure credentials

You first need to Register a new app to get your credentials. Rename .env.example to .env and fill it with your details.

Creating scripts

You can take a look at script_template for a quick example.

To send a POST request use:

$body = ['key' => 'value'];
$response = $intraRequest->post('/api/uri', $body);

To send a GET request use:

$parameter = ['key' => 'value'];
$response = $intraRequest->get('/api/uri', $parameter);

The $response contains the raw text, so if you want to use it you will probably need to decode it:

$response = json_decode($response);

About

Scripts to interact with the 42 Intra's API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages