Cdiscount Authorization
The authentication is fairly easy and straight forward we will be using our client id and client secret which always will be the same (can be store in integration and integration_credentials tables)
Ready Postman Collection:
API Call: POST https://auth.octopia.com/auth/realms/maas/protocol/openid-connect/token
Body:
client_id:{contact Bogomil Pavlov }
client_secret:{contact Bogomil Pavlov }
grant_type:client_credentials
Sample Respons:
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJidFdVUi03TUQxRnZSUWlvY2pSMnBxaFlJQnZUQXpoQ0EwVXNNNGhxOGFrIn0.eyJleHAiOjE2NjkwMzU5MDEsImlhdCI6MTY2OTAyODcwMSwianRpIjoiOTcxNTM0ZjgtZTVmOS00YzBkLWE5ZTktMjg0NjY4MDhhOTBkIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLm9jdG9waWEuY29tL2F1dGgvcmVhbG1zL21hYXMiLCJhdWQiOlsiU0VMTEVSX01BUktFVFBMQUNFLUFQSSIsIklOVEVSTkFUSU9OQUwtTE9HSVNUSUMtU1RPQ0tfU1RPQ0stTUFOQUdFTUVOVC1BUEkiLCJJTlRFUk5BVElPTkFMLUVWRU5ULU1BTkFHRU1FTlRfREVNLVNFTExFUiIsIklOVEVSTkFUSU9OQUwtTE9HSVNUSUNfSU5CT1VORC1TSElQTUVOVC1BUEkiLCJJTlRFUk5BVElPTkFMLVBST0RVQ1QtSU5URUdSQVRJT05fUFJPRFVDVFMtQVBJIiwiSU5URVJOQVRJT05BTC1PUkRFUi1TRUxMRVJfU0VMTEVSLU9SREVSLUFQSSIsIklOVEVSTkFUSU9OQUwtUFJPRFVDVC1SRUZFUkVOVElBTF9SRUZFUkVOVElBTC1BUEkiLCJhY2NvdW50IiwiSU5URVJOQVRJT05BTC1MT0dJU1RJQy1QQVJDRUxfUEFSQ0VMLVRSQUNLSU5HIl0sInN1YiI6ImRkYzk4MDFjLWNjNGMtNGZjMi1hMzA2LTcyM2EwYmQ2MDc4MyIsInR5cCI6IkJlYXJlciIsImF6cC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ElPTkFMLU9SREVSLVNFTExFUl9TRUxMRVItT1JERVItQVBJIjp7InJvbGVzIjpbIk9SREVSU19HRVQiLCJPUkRFUlNfU0hJUE1FTlRTX1BPU1QiXX0sIklOVEVSTkFUSU9OQUwtUFJPRFVDVC1SRUZFUkVOVElBTF9SRUZFUkVOVElBTC1BUEkiOnsicm9sZXMiOlsiQ0FURUdPUklFU19HRVQiXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfSwiSU5URVJOQVRJT05BTC1MT0dJU1RJQy1QQVJDRUxfUEFSQ0VMLVRSQUNLSU5HIjp7InJvbGVzIjpbIkNBUlJJRVJTX0dFVCJdfX0sInNjb3BlIjoiIiwiY2xpZW50SWQiOiJIZW1pIiwiY2xpZW50SG9zdCI6IjEwLjEwLjEwLjI0MSIsImNsaWVudEFkZHJlc3MiOiIxMC4xMC4xMC4yNDEifQ.a_QnTUNspMTvaFUjLF6-g_pfpGqLbw3ESDMpeQj78g3uHk7V90NiaPkdlfG8i-arMU9GQ0LbfD_xLKH-bFfS-RYAJcJe6Mru3P5Viobw83R3LeeqzcRuotJeJhLS7XfD9fw-s-y0TPi4I-DZFDb-cx6U4Nn0Mp9BJVpjvj7zrHn3vVUkAViZiPLKKEB5pYfMfQWWIrsbLXbWyf51Q7UDU4Kp87QHuNunluwr5QjNsHudFnZbH1P5R7-z9kuHVvUBnVqV0cBm9QgELcNmAKdN9q12-wlRFQVol8RfpRKLJZCPkQRbXWYuBs8baKELwRuJD3q7HlXekka4p2yGZZBMuA",
"expires_in": 7200,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": ""
}
We will need to use the access token for each request we are making to Cdiscount as a Bearer Token and the SellerId as a header. Please note the seller id will need to go into Account Cdiscount table as it will be different for each seller as well as the Country (Available countries are France (id = 1) and Belgium (id = 14)).
There is not sandbox environment but they provide test seller id which we can use. Your tests are to be carried out with the SellerId 98979 that we make available to you (see screenshot below). To do this, you must add it as a parameter in the header of your calls.
You will receive the correct or incorrect answer to your call in return.
The parameters to keep in mind for your future calls out of the portal are :
- The SellerId to enter in the header
- Your OCP-APIM-Subscription key for your subscribed API product (Sandbox only)
Error Handling:
Response: 400 Bad Request
A URI reference that identifies the specific occurrence of the problem
DEFAULT - JSON Copy
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred",
"status": 400,
"traceId": "dbb935dd-9884-4513-b22f-38e443632edb",
"errors": {
"MyField": ["The field is required"]
}
}
Response: 401 Unauthorized
A URI reference that identifies the specific occurrence of the problem
DEFAULT - JSON Copy
{
"type": "Unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "details"
}
Response: 403 Forbidden
A URI reference that identifies the specific occurrence of the problem
DEFAULT - JSON Copy
{
"type": "Forbidden",
"title": "Forbidden",
"status": 403,
"detail": "details"
}
Response: 404 Not Found
A URI reference that identifies the specific occurrence of the problem
DEFAULT - JSON Copy
{
"type": "Not Found",
"title": "Not Found",
"status": 404,
"detail": "details"
}
Response: 500 Internal Server Error
A URI reference that identifies the specific occurrence of the problem
DEFAULT - JSON Copy
{
"type": "Internal Server error",
"title": "Internal Server error",
"status": 500,
"detail": "details"
}