Library or example for use EPO with Guzzle

This space is made available to users of Open Patent Services (OPS) web-service and now also to users of EPO’s bulk data subscription products such as 14. EPO worldwide bibliographic database (DOCDB), 14.11 EPO worldwide legal status database (INPADOC), 14.12 EP full text data, 14.1 EP bibliographic data (EBD)and more.

Users can ask each other questions, exchange experiences and solutions, post ideas. The moderator will use this space to announce changes or other relevant information.
Post Reply

excellenting
Posts: 11
Joined: Mon Jun 05, 2017 5:40 pm

Library or example for use EPO with Guzzle

Post by excellenting » Mon Jun 12, 2017 7:28 am

Hi

I'm looking for any documentation about use library Guzzle and EPO.

I tried some aproach, but fails.

Apreciate help.


EPO / OPS Support
Posts: 999
Joined: Thu Feb 22, 2007 5:32 pm

Re: Library or example for use EPO with Guzzle

Post by EPO / OPS Support » Mon Jun 12, 2017 1:10 pm

Hi,

What exactly didn't work? As much as details you can give the more we are able to help,

Regards,
OPS support


excellenting
Posts: 11
Joined: Mon Jun 05, 2017 5:40 pm

Re: Library or example for use EPO with Guzzle

Post by excellenting » Mon Jun 12, 2017 2:44 pm

Hi.

I'm try to connect with guzzle.

Code: Select all

$base_uri           = 'https://ops.epo.org/3.2/';
        $consumerKey        = 'myconsumerkey';
        $consumerSecretKey  =' mysecretkey';

        $client = new Client([
            'base_uri'      => 'https://ops.epo.org/3.2/'
        ]);
        $request = $client->post('auth/accesstoken', null, array(
            'consumerKey'               => 'VFfoz7HnXxBffo263mbjaAZijWCdzFgS',
            'consumerSecretKey'         => 'ymwlMPJzNrlF9KuF',
            'grant_type'                => 'client_credentials'
        ));
This get error understanding

Code: Select all

 [GuzzleHttp\Exception\ClientException]                                                                    
  Client error: `POST https://ops.epo.org/3.2/auth/accesstoken` resulted in a `401 Unauthorized` response:  
  <error><code>401</code><message>Client identifier is required</message>                                   
                        </error>  


excellenting
Posts: 11
Joined: Mon Jun 05, 2017 5:40 pm

Re: Library or example for use EPO with Guzzle

Post by excellenting » Mon Jun 12, 2017 4:49 pm

Also I tried with curl

Code: Select all

$base_uri           = 'https://ops.epo.org/3.2/';
$consumerKey        = 'MyConSumerKey';
$consumerSecretKey  = 'MySecretKey';

$authorization = base64_encode(($consumerKey.':'.$consumerSecretKey));

$tokens =  curl_init();
$url = 'https://ops.epo.org/3.2/auth/accesstoken';
curl_setopt($tokens, CURLOPT_URL, $url);
curl_setopt($tokens, CURLOPT_HTTPHEADER,[
    'authorization'     => $authorization,
    'content-type'      => 'application/x-www-form-urlencoded',
    'grant_type'        => 'client_credentials'
]);
curl_setopt($tokens, CURLOPT_POST,true);

dd(curl_exec($tokens));
Error

Code: Select all

<error><code>401</code><message>Client identifier is required</message>
                        </error>


EPO / OPS Support
Posts: 999
Joined: Thu Feb 22, 2007 5:32 pm

Re: Library or example for use EPO with Guzzle

Post by EPO / OPS Support » Tue Jun 13, 2017 6:06 am

Hi,

Do you have activated OPS account? This kind of questions would be better addresses if you write to us directly than over a public forum because we need to check you user credentials.

As far as token, in OPS documentation that is liked here several times, you will find how to process your token corectly. Also, in the Announcement section in this forum we have some aditional information related to only v 3.2, so please check that.

Otherwise, maybe some use uses same tool as you and they might be of help with connecting our web service.

Regards,
OPS support


excellenting
Posts: 11
Joined: Mon Jun 05, 2017 5:40 pm

Re: Library or example for use EPO with Guzzle

Post by excellenting » Thu Jun 15, 2017 7:09 am

Hi.

After problems with doc of Guzzle, and examples for use with EPO,

I have preferred to build my own class and make connections with cURL. Now everything works for me. Thank you.

Brest regards


Post Reply