Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Endpoint URL
- */
- $url = url('api/v2/rack');
- /**
- * First Admin API Key - you should enter your own user api key
- */
- $apikey = \User::admins()->first()->apikey->key;
- $client = new \GuzzleHttp\Client();
- try {
- $response = $client->request('POST', $url, [
- 'headers' => [
- 'Accept' => 'application/json',
- 'apikey' => $apikey
- ],
- 'json' => [
- 'data' => [
- 'name' => 'Test Rack 1',
- 'floor_id' => 4,
- 'location_id' => 1,
- 'units_number' => 10
- ],
- ]
- ]);
- $stream = \GuzzleHttp\Psr7\stream_for($response->getBody());
- d($stream->getContents());
- } catch (\Exception $e) {
- d($e->getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement