Git Product home page Git Product logo

bcsapiwrapper's Introduction

BCS API Wrapper Library BCSAPI Library V4

Latest Stable Version Total Downloads Latest Unstable Version License

install

 composer require tobya/bcsapiwrapper

Publish config file

php artisan vendor:publish

select BCSApiWrapper

.env updates The following values need to be available in .env file

# Main BCS Api URLS
BCSBACKOFFICE_APIURL=
BCSBACKOFFICE_APIKEY=

# New BCS V4 Api Urls / V3 discontinued
BCSBACKOFFICE_V4_APIURL=
BCSBACKOFFICE_V4_APITOKEN=


# Photo Api
DEMOPHOTO_APIURL=

#Recipe Api
BCSRECIPE_APIURL=
BCSRECIPE_APIKEY=

Keep up to date

composer update

Upgrading from V2

You need to add the following to config/bcsapi.php

  'v4' => [
            'backoffice' => [
                'url' => env('BCSBACKOFFICE_V4_APIURL',''),
                'token' => env('BCSBACKOFFICE_V4_APITOKEN',''),
            ],
        ]

and .env is

BCSBACKOFFICE_V4_APIURL={base host url, not api.backoffice.ie}
BCSBACKOFFICE_V4_APITOKEN={sanctum token}

V2 BCSApiWrapper

$CourseApi =  App('BCSApi')->Course();
$CourseInfo = $CourseApi->CourseInfo(12345);
echo $CourseInfo->CourseName;

V4 BCSApiWrapper

$CourseApi = BCSLoader::Course();
$CourseInfo = $CourseApi->CourseInfo(12345);
echo $CourseInfo->CourseName;

This may require rewriting of quite a bit of code on upgrading.

Tests

There is a Postman Collection to do tests on the main BCSApi routes.

https://github.com/tobya/bcsStudents_gitp4/blob/LaravelSubscriptions/resources/postman/api.cookingisfun.ie%20v2.postman_collection.json

bcsapiwrapper's People

Contributors

ariashahdadi avatar tobya avatar tushargugnani avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

ariashahdadi

bcsapiwrapper's Issues

V4:

Upgrade to V4

Standardise all calls to a single system using Sanctum tokens

Overwrite config file on upgrade

This shoudl be possible since most values are in .env file and no changes should have been made to bcsapi.php and any that have should be in source control

Improve Error Handling

If an error happens in the api wrapper often the full error code is returned, or the handled error with html from a ddd is returned.

We should catch any error that happens and return a valid json string to the client whatever.

Catch errors in network

At the moment a curl error will give a 500 error for the whole thing. Should at least capture and raise a proper error back

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.