Skip to content

Issue creating snippet #43

Closed
Closed
@jloh

Description

@jloh

I can't work out what I'm doing wrong. I've got the following code:

<?php

require 'vendor/autoload.php';

$client = new \Gitlab\Client('https://gitlab.example.com/api/v3/'); // change here
$client->authenticate('not_actually_real', \Gitlab\Client::AUTH_URL_TOKEN); // change here

$project = new \Gitlab\Model\Project(17, $client);
$snippet = $project->createSnippet('title', 'someting.txt', 'code_is_cool');

?>

But I'm getting the following error:

Fatal error: Uncaught exception 'Gitlab\Exception\InvalidArgumentException' in /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php:115
Stack trace:
#0 /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/AbstractModel.php(31): Gitlab\Client->api('snippets')
#1 /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php(464): Gitlab\Model\AbstractModel->api('snippets')
#2 /gitlab/test.php(24): Gitlab\Model\Project->createSnippet('title', 'someting.txt', 'code_is_cool')
#3 {main}
  thrown in /gitlab/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php on line 115

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions