POST data to an endpoint to request an OAuth access token

The Basic Authentication string is generated by base64 encoding a username and password concatenated with a :. This shoul be a different username and password to the one passed as the data -d parameter.

curl -X POST http://localhost/api/oauth/v1/token 
    -H "Content-Type: application/json" 
    -H "Authorization: Basic MV8ydjc5ODE4dXFxMDQwd2Mwc2NjazRjMGtjazhrZ3cwNGdvb3dnZ29nZ3c4ODhjb2drNDo1ZDRiZTQ0azN1bzA0a2cwbzAwMG8wa3djNDgwOHN3ZzQ4c2N3czQ0NGcwMG9rNGMwbw==" 
    -d '{
        "grant_type": "password",
        "username": "my username",
        "password": "my password"
    }'

GET a resource from an endpoint

The resulting access token is passed as the Bearer Authentication string when accessing an oauth protected endpoint.

curl http://localhost/api/rest/v1/media-files 
    -H "Authorization: Bearer NDg0MjU0MjFhZThiMzNlNmJiNTgzNzY4MmNlN2JlNDUyMTIxMDZjYmE2NjAyYmZmZDUxZDg5YzE0NjE2MTg1Yg"

POST a file to an endpoint

Here we are posting a file to an endpoint with Bearer Authentication.

curl -X POST http://localhost.128/api/rest/v1/media-files 
    -H "Content-Type: multipart/form-data" 
    -H "Authorization: Bearer YWE2NjBhYTZkMGY1MjcwNzhkYTcxNDE4MzYwMGU3ZjE5NWQzYzY2ZDRjOThhZWU5Nzk0MTk4ZjAwNzQwMjYwZQ" 
    -F product_model='{"code":"CHR0014", "attribute":"image", "scope":null, "locale":null}' 
    -F file=@/tmp/test.png