Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.
hub_principal:examples_api_json [2013/11/04 10:40] Dilicom |
hub_principal:examples_api_json [2018/04/23 11:22] (version actuelle) |
||
---|---|---|---|
Ligne 6: | Ligne 6: | ||
Notre API [[http://fr.wikipedia.org/wiki/Representational_State_Transfer|REST]]/[[http://fr.wikipedia.org/wiki/HTTP|Http]] utilise de simples requêtes HTTP GET avec un passage d'arguments standard. En cas d'erreur dans les arguments le serveur renvoie un code 403 (BadRequest) avec une description JSON des champs erronés. Il est à noter qu'une réponse 200 **OK** ne signifie pas forcément que le service appelé s'est exécuté correctement mais qu'il a répondu correctement. Il faudra comme pour le web service soap vérifier la valeur du champ returnStatus. | Notre API [[http://fr.wikipedia.org/wiki/Representational_State_Transfer|REST]]/[[http://fr.wikipedia.org/wiki/HTTP|Http]] utilise de simples requêtes HTTP GET avec un passage d'arguments standard. En cas d'erreur dans les arguments le serveur renvoie un code 403 (BadRequest) avec une description JSON des champs erronés. Il est à noter qu'une réponse 200 **OK** ne signifie pas forcément que le service appelé s'est exécuté correctement mais qu'il a répondu correctement. Il faudra comme pour le web service soap vérifier la valeur du champ returnStatus. | ||
- | Les arguments sont les mêmes que dans l'interface SOAP. Chaque méthode a sa propre URL : | ||
- | * Récupération des notices **getNotices()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getNotices</html> | ||
- | * Vérification des disponibilités **checkAvailability()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/checkAvailability</html> | ||
- | * Passage de commande **sendOrder()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/sendOrder</html> | ||
- | * Récupération d'un lien **getOrderDetails()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getOrderDetails</html> | ||
- | * Passage de commande **getDigitalVersions()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getDigitalVersions</html> | ||
- | * Récupération d'un lien **getDetailNotices()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getDetailNotices</html> | ||
- | * Télécharger une notice au format ONIX **getNotice()** : <html>https://hub-dilicom.centprod.com/v1/hub-numerique-api/onix/getNotice</html> //Cette url renvoie un message ONIX directement // | ||
+ | |||
+ | __**Exemple d'utilisation** :__ | ||
+ | |||
+ | * Exemple d'utilisation de cette API dans un script python : [[exemple_api_python|Exemple python]] | ||
+ | * Exemple d'utilisation de cette API dans un script php : [[exemple_api_php|Exemple php]] | ||
+ | Pour tester cette Api confortablement il est possible d'utiliser le plugin [[https://addons.mozilla.org/en-US/firefox/addon/10869/|JSON View]] sous Firefox. | ||
Vous trouverez ci-dessous des exemples d'appel et de retour de notre API REST. | Vous trouverez ci-dessous des exemples d'appel et de retour de notre API REST. | ||
- | <note tip>Exemple d'utilisation de cette API dans un script python : [[exemple_api_python|Exemple python]]</note> | ||
- | <note tip>Exemple d'utilisation de cette API dans un script php : [[exemple_api_php|Exemple php]]</note> | ||
- | <note tip>Pour tester cette Api confortablement il est possible d'utiliser le plugin [[https://addons.mozilla.org/en-US/firefox/addon/10869/|JSON View]] sous Firefox.</note> | ||
+ | Pour connaître la dernière version en cours et l'adresse des services [[hub_principal:start|cliquer ici ]] | ||
===== Authentification ===== | ===== Authentification ===== | ||
Cette API utilise l'authentification [[http://fr.wikipedia.org/wiki/HTTP_Authentification|HTTP Basic]]. Vous devez donc utiliser votre **glnReseller** et votre **passwordReseller** comme authentifiant HTTP. Les paramètres d'entée **glnReseller** et **passwordReseller** ne sont donc pas, contrairement a l'api SOAP, nécessaires. | Cette API utilise l'authentification [[http://fr.wikipedia.org/wiki/HTTP_Authentification|HTTP Basic]]. Vous devez donc utiliser votre **glnReseller** et votre **passwordReseller** comme authentifiant HTTP. Les paramètres d'entée **glnReseller** et **passwordReseller** ne sont donc pas, contrairement a l'api SOAP, nécessaires. | ||
- | ===== Récupération des notices : getNotices() ===== | ||
+ | ===== Les statuts HTTP des réponses HUB===== | ||
+ | ^Code ^ Statut ^ Description^ | ||
+ | |200|OK| Le serveur a accepté de traiter la requête. **//Le statut de traitement de la requête est défini dans le champ returnStatus//**| | ||
+ | |400|Bad Request| Le serveur HUB ne peut pas traiter la requête puisque la requête ne respecte pas le [[hub_principal:start#|WSDL]] | | ||
+ | |401|Unauthorized| Appel d'un service sans authentification [[http://fr.wikipedia.org/wiki/HTTP_Authentification|HTTP Basic]]| | ||
+ | |403|Forbidden|Les paramètres d'authentification sont erronés | | ||
+ | |500|Internal Server Error| Erreur technique du serveur PNB| | ||
- | ==== Interrogation du web service ==== | + | ===== Vérification des disponibilités : checkAvailability() ===== |
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/checkAvailability?** | ||
- | === Cas 1=> Initialisation du catalogue (non actif, le catalogue d'initialisation est fourni par FTP) === | ||
- | <note important> | ||
- | Attention : l'option initialization a été désactivée, merci de contacter Dilicom pour plus d’informations. | ||
- | </note> | ||
- | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getNotices?initialization | ||
- | </code> | ||
- | |||
- | === Cas 2 => Récupération depuis un instant T === | ||
- | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getNotices?sinceDate=2010-08-20T00:00:00 | ||
- | </code> | ||
- | |||
- | |||
- | === Cas 3 => Récupération depuis la dernière connexion === | ||
- | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getNotices?lastConnection | ||
- | </code> | ||
- | |||
- | ==== Réponse du Web Service ==== | ||
- | <code javascript> | ||
- | { | ||
- | onixFileUrls:[{ | ||
- | httpLink:"https://hub-dilicom.centprod.com/notices_onyx/diffusion_3025594195700_201008272128_1110247456419854240546744705832927698715.xml" | ||
- | },{ | ||
- | httpLink:"https://hub-dilicom.centprod.com/notices_onyx/diffusion_3025594164342_201008272330_1256851354542405467447058329276987145685.xml" | ||
- | }], | ||
- | returnStatus:"OK" | ||
- | } | ||
- | </code> | ||
- | |||
- | <note important>L'exemple présente le cas où plusieurs fichiers sont renvoyés. Actuellement le web service renvoie toujours un seul lien, cependant il est possible qu'à terme il soit nécessaire de renvoyer plusieurs liens.</note> | ||
- | |||
- | Ou bien lorsque aucune notice ne correspond à la demande : | ||
- | <code javascript> | ||
- | { | ||
- | noNotice: "", | ||
- | returnStatus:"OK" | ||
- | } | ||
- | </code> | ||
- | |||
- | ===== Vérification des disponibilités : checkAvailability() ===== | ||
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/checkAvailability? | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/checkAvailability? |
- | checkAvailabilityLines[0].ean13=9782296408876 | + | glnContractor=0000000000000 |
- | &checkAvailabilityLines[0].glnDistributor=3012410105012 | + | &country=FR |
- | &checkAvailabilityLines[0].unitPrice=1 | + | &checkAvailabilityLines[0].ean13=9791093983004 |
- | &checkAvailabilityLines[1].ean13=9782296408870 | + | &checkAvailabilityLines[0].glnDistributor=3012410001000 |
- | &checkAvailabilityLines[1].glnDistributor=3012410105012 | + | &checkAvailabilityLines[0].unitPrice=399 |
- | &checkAvailabilityLines[1].unitPrice=1 | + | &checkAvailabilityLines[1].ean13=9791093594712 |
+ | &checkAvailabilityLines[1].glnDistributor=3012410002007 | ||
+ | &checkAvailabilityLines[1].unitPrice=799 | ||
+ | &checkAvailabilityLines[1].unitPriceExcludingTax=450 | ||
+ | &checkAvailabilityLines[1].unitPriceExcludingTax=EUR | ||
</code> | </code> | ||
Ligne 88: | Ligne 54: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | checkAvailabilityResponseLines: [ | + | "checkAvailabilityResponseLines" : [ { |
- | { | + | "glnDistributor" : "3012410002007", |
- | glnDistributor: "3012410105012" | + | "ean13" : "9791093594712", |
- | returnStatus: "OK" | + | "checkAvailabilityReturnValue" : "AVAILABLE", |
- | returnMessage: [ | + | "returnStatus" : "OK" |
- | "The EAN13 9782296408870 does not exists for Distributor GLN 3012410105012" | + | }, { |
- | ] | + | "glnDistributor" : "3012410001000", |
- | ean13: "9782296408870" | + | "ean13" : "9791093983004", |
- | checkAvailabilityReturnValue: "UNAVAILABLE" | + | "checkAvailabilityReturnValue" : "AVAILABLE", |
- | } | + | "returnStatus" : "OK" |
- | { | + | } ], |
- | glnDistributor: "3012410105012" | + | "returnStatus" : "OK" |
- | returnStatus: "OK" | + | |
- | ean13: "9782296408876" | + | |
- | checkAvailabilityReturnValue: "AVAILABLE" | + | |
- | } | + | |
- | ] | + | |
- | returnStatus: "OK" | + | |
- | returnMessage: [] | + | |
} | } | ||
Ligne 112: | Ligne 71: | ||
===== Passage de commandes : sendOrder() ===== | ===== Passage de commandes : sendOrder() ===== | ||
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/sendOrder?** | ||
+ | |||
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/sendOrder? | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/sendOrder? |
- | glnGroup=6235482301523 | + | orderId=ORDER0001 |
- | &orderId=ORDER0001 | + | &glnGroup=6235482301523 |
+ | &glnContractor=0000000000000 | ||
&customerId=test | &customerId=test | ||
&finalBookOwner.identifier=test | &finalBookOwner.identifier=test | ||
Ligne 124: | Ligne 87: | ||
&finalBookOwner.lastName=Doe | &finalBookOwner.lastName=Doe | ||
&finalBookOwner.email=john@doe.com | &finalBookOwner.email=john@doe.com | ||
- | &finalBookOwner.country=France | + | &finalBookOwner.country=FR |
&finalBookOwner.city=Paris | &finalBookOwner.city=Paris | ||
&finalBookOwner.postalCode=75000 | &finalBookOwner.postalCode=75000 | ||
- | &orderRequestLines[0].ean13=9782814500136 | + | &orderRequestLines[0].ean13=9791093983004 |
&orderRequestLines[0].glnDistributor=3012410001000 | &orderRequestLines[0].glnDistributor=3012410001000 | ||
- | &orderRequestLines[0].quantity=125 | + | &orderRequestLines[0].quantity=1 |
- | &orderRequestLines[0].unitPrice=1 | + | &orderRequestLines[0].unitPrice=99 |
- | &orderRequestLines[0].lineReference=01 | + | &orderRequestLines[0].lineReference=RefLine1 |
- | &orderRequestLines[1].ean13=9990000000001 | + | &orderRequestLines[0].specialCode=SpecialCode |
+ | &orderRequestLines[1].ean13=9791093594712 | ||
&orderRequestLines[1].glnDistributor=3012410002007 | &orderRequestLines[1].glnDistributor=3012410002007 | ||
&orderRequestLines[1].quantity=1 | &orderRequestLines[1].quantity=1 | ||
- | &orderRequestLines[1].lineReference=02 | + | &orderRequestLines[1].lineReference=RefLine12 |
- | &orderRequestLines[1].unitPrice=1 | + | &orderRequestLines[1].unitPrice=799 |
+ | &orderRequestLines[1].unitPriceExcludingTax=450 | ||
+ | &orderRequestLines[1].currency=EUR | ||
</code> | </code> | ||
Ligne 142: | Ligne 108: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | returnStatus: "OK", | + | "orderId" : "ORDER0001", |
- | orderId: "ORDER0001", | + | "orderLines" : [ { |
- | orderLines: [{ | + | "ean13" : "9791093983004", |
- | ean13: "9990000000001", | + | "glnDistributor" : "3012410001000", |
- | glnDistributor: "3012410002007", | + | "links" : [ { |
- | returnStatus: "OK", | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52594-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", |
- | links: [{ | + | "ean13" : "3612220747466", |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9990000000001-3012410002007/96-21-K9RY82112MOO8SSKDOAEI8D7WTKPP83J.do", | + | "mimetype" : "text/html", |
- | formatDescription: "Unknown Format", | + | "formatDescription" : "HTML", |
- | ean13: "9990000000001" | + | "format" : "E105" |
- | }], | + | }, { |
- | orderLineId: "96", | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52595-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", |
- | lineReference:"01" | + | "ean13" : "3612220747442", |
- | },{ | + | "mimetype" : "application/x-mobipocket-ebook", |
- | ean13: "9782814500136", | + | "formatDescription" : "Mobipocket", |
- | glnDistributor: "3012410001000", | + | "format" : "E127" |
- | returnStatus: "OK", | + | }, { |
- | links: [{ | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52596-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", |
- | format: "E127", | + | "ean13" : "3612220747459", |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-22-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | "mimetype" : "application/epub+zip", |
- | mimetype: "application/x-mobipocket", | + | "formatDescription" : "EPUB", |
- | formatDescription: "Mobipocket", | + | "format" : "E101" |
- | ean13: "9782814500136" | + | } ], |
- | },{ | + | "orderLineId" : "8515", |
- | format: "E107", | + | "lineReference" : "RefLine1", |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-23-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | "returnStatus" : "OK" |
- | mimetype: "application/pdf", | + | }, { |
- | formatDescription: "PDF", | + | "ean13" : "9791093594712", |
- | ean13: "9782814500136" | + | "glnDistributor" : "3012410002007", |
- | },{ | + | "links" : [ { |
- | format: "E107", | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093594712-3012410002007/8516-40155-7V4OBS3Y7MRF79ZK7ETKA4P3BCEV6GVR.do", |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-24-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | "ean13" : "9791093594712", |
- | mimetype: "application/pdf", | + | "mimetype" : "application/epub+zip", |
- | formatDescription: "PDF", | + | "formatDescription" : "EPUB", |
- | ean13: "9782814500136" | + | "format" : "E101" |
- | },{ | + | } ], |
- | format: "E105", | + | "orderLineId" : "8516", |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-25-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | "lineReference" : "RefLine12", |
- | mimetype: "text/html", | + | "currency" : "EUR", |
- | formatDescription: "HTML", | + | "returnStatus" : "OK" |
- | ean13: "9782814500136" | + | } ], |
- | }], | + | "returnStatus" : "OK" |
- | orderLineId: "95", | + | |
- | lineReference:"02" | + | |
- | }] | + | |
} | } | ||
</code> | </code> | ||
- | + | ===== Annulation d'une commande : cancelOrder() ===== | |
- | ===== Récupération des détails d'une commande : getOrderDetails() ===== | + | ==== URL ==== |
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/cancelOrder?** | ||
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getOrderDetail?orderId=ORDER0001 | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/cancelOrder? |
+ | orderId=ORDER0001 | ||
+ | &glnContractor=0000000000000 | ||
+ | &reason=test | ||
+ | &cancelOrderLines[0].ean13=9791093983004 | ||
+ | &cancelOrderLines[0].glnDistributor=3012410001000 | ||
</code> | </code> | ||
Ligne 201: | Ligne 170: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | returnStatus: "OK", | + | "orderId" : "ORDER0001", |
- | orderId: "ORDORDER0001", | + | "cancelOrderResponseLines" : [ { |
- | orderLines: [{ | + | "glnDistributor" : "3012410001000", |
- | ean13: "9990000000001", | + | "ean13" : "9791093983004", |
- | glnDistributor: "3012410002007", | + | "returnStatus" : "CANCELLED" |
- | returnStatus: "OK", | + | } ], |
- | links: [{ | + | "returnStatus" : "OK" |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9990000000001-3012410002007/96-21-K9RY82112MOO8SSKDOAEI8D7WTKPP83J.do", | + | |
- | formatDescription: "Unknown Format", | + | |
- | ean13: "9990000000001" | + | |
- | }], | + | |
- | orderLineId: "96", | + | |
- | lineReference:"01" | + | |
- | },{ | + | |
- | ean13: "9782814500136", | + | |
- | glnDistributor: "3012410001000", | + | |
- | returnStatus: "OK", | + | |
- | links: [{ | + | |
- | format: "E127", | + | |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-22-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | |
- | mimetype: "application/x-mobipocket", | + | |
- | formatDescription: "Mobipocket", | + | |
- | ean13: "9782814500136" | + | |
- | },{ | + | |
- | format: "E107", | + | |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-23-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | |
- | mimetype: "application/pdf", | + | |
- | formatDescription: "PDF", | + | |
- | ean13: "9782814500136" | + | |
- | },{ | + | |
- | format: "E107", | + | |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-24-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | |
- | mimetype: "application/pdf", | + | |
- | formatDescription: "PDF", | + | |
- | ean13: "9782814500136" | + | |
- | },{ | + | |
- | format: "E105", | + | |
- | url: "https://hub-dilicom.centprod.com/v1/link/3025594195700/ORDORDER0001/9782814500136-3012410001000/95-25-O70IIWUBEF85G8I2THAPFM9OA2CPRBMX.do", | + | |
- | mimetype: "text/html", | + | |
- | formatDescription: "HTML", | + | |
- | ean13: "9782814500136" | + | |
- | }], | + | |
- | orderLineId: "95", | + | |
- | lineReference:"02" | + | |
- | }] | + | |
} | } | ||
</code> | </code> | ||
- | ===== Obtention des version numériques associé à des ean physiques : getDigitalVersions() ===== | + | ===== Récupération des détails d'une commande : getOrderDetails() ===== |
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/getOrderDetails?** | ||
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getDigitalVersions? | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/getOrderDetail?glnContractor=0000000000000&orderId=ORDER0001 |
- | physicalEans[0]=9782092524374 | + | |
- | &physicalEans[1]=9782212120035 | + | |
</code> | </code> | ||
Ligne 261: | Ligne 192: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | returnStatus: "OK", | + | "returnStatus" : "OK", |
- | physicalVersions: [{ | + | "orderId" : "ORDER0001", |
- | ean13: "9782092524374", | + | "orderLines" : [ { |
- | digitalVersions: [{ | + | "ean13" : "9791093983004", |
- | ean13: "9782092528068" | + | "glnDistributor" : "3012410001000", |
- | glnDistributor: "3012410003004" | + | "links" : [ { |
- | }] | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52594-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", |
+ | "ean13" : "3612220747466", | ||
+ | "mimetype" : "text/html", | ||
+ | "formatDescription" : "HTML", | ||
+ | "format" : "E105" | ||
}, { | }, { | ||
- | ean13: "9782212120035" | + | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52595-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", |
- | noDigitalVersion: "" | + | "ean13" : "3612220747442", |
- | }] | + | "mimetype" : "application/x-mobipocket-ebook", |
+ | "formatDescription" : "Mobipocket", | ||
+ | "format" : "E127" | ||
+ | }, { | ||
+ | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093983004-3012410001000/8515-52596-HOEJPC4H7OI89C1SHRO06D1XTG9U7VD4.do", | ||
+ | "ean13" : "3612220747459", | ||
+ | "mimetype" : "application/epub+zip", | ||
+ | "formatDescription" : "EPUB", | ||
+ | "format" : "E101" | ||
+ | } ], | ||
+ | "orderLineId" : "8515", | ||
+ | "lineReference" : "RefLine1", | ||
+ | "returnStatus" : "OK" | ||
+ | }, { | ||
+ | "ean13" : "9791093594712", | ||
+ | "glnDistributor" : "3012410002007", | ||
+ | "links" : [ { | ||
+ | "url" : "https://hub-dilicom.centprod.com/v3//link/3026900001000/ORDER0001/9791093594712-3012410002007/8516-40155-7V4OBS3Y7MRF79ZK7ETKA4P3BCEV6GVR.do", | ||
+ | "ean13" : "9791093594712", | ||
+ | "mimetype" : "application/epub+zip", | ||
+ | "formatDescription" : "EPUB", | ||
+ | "format" : "E101" | ||
+ | } ], | ||
+ | "orderLineId" : "8516", | ||
+ | "lineReference" : "RefLine12", | ||
+ | "currency" : "EUR", | ||
+ | "returnStatus" : "OK" | ||
+ | } ] | ||
} | } | ||
</code> | </code> | ||
- | ===== Obtention de notices onix d'une liste d'ean/distributeur : getDetailNotices() ===== | + | ===== Obtention des version numériques associé à des ean physiques : getDigitalVersions() ===== |
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/getDigitalVersions?** | ||
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | http:/hub.dilicom.net/hub-numerique-api/json/getDetailNotices? | + | https://hub-dilicom.centprod.com/v1/hub-numerique-api/json/getDigitalVersions? |
- | notices[0].ean13=9782092528068 | + | glnContractor=3026900001000 |
- | ¬ices[0].glnDistributor=3012410003004 | + | &physicalEans[0]=9782092524374 |
- | ¬ices[1].ean13=9782092628068 | + | &physicalEans[1]=9782212120035 |
- | ¬ices[1].glnDistributor=3012410003004 | + | |
</code> | </code> | ||
Ligne 289: | Ligne 252: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | detailNotices: [{ | + | "physicalVersions" : [ { |
- | ean13: "9782092528068", | + | "ean13" : "9782092524374", |
- | glnDistributor: "3012410003004", | + | "noDigitalVersion" : "" |
- | onixProduct: "<ONIXMessage>.....</ONIXMessage>" | + | }, { |
- | }, { | + | "digitalVersions" : [ { |
- | ean13: "9782092628068", | + | "glnDistributor" : "3012410001000", |
- | glnDistributor: "3012410003004", | + | "ean13" : "9782212850888" |
- | noNotice: "" | + | } ], |
- | }, | + | "ean13" : "9782212120035" |
- | returnStatus: "OK" | + | } ], |
+ | "returnStatus" : "OK" | ||
} | } | ||
</code> | </code> | ||
+ | ===== Récupération des notices : getNotices() ===== | ||
- | ===== Chargement de la notices d'un produit directement au format ONIX : getNotice() ===== | + | ==== URL ==== |
- | <note important>Attention se service ne retourne pas du JSON mais directement un message ONIX, donc au format XML.</note> | + | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/getNotices?** |
==== Interrogation du web service ==== | ==== Interrogation du web service ==== | ||
+ | |||
+ | === Cas 1 – Initialisation du catalogue (service désactivé, le catalogue d'initialisation est fourni par FTP) === | ||
+ | <note important> | ||
+ | Attention : l'option initialization a été désactivée, merci de contacter Dilicom pour plus d’informations. | ||
+ | </note> | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/onix/getNotice? | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/getNotices?glnGroup=0000000000000&glnContractor=30269000010012&initialization |
- | ean13=3600120309440 | + | |
- | &glnDistributor=3012410001000 | + | |
</code> | </code> | ||
- | ==== Réponse du web service ==== | + | === Cas 2 - Récupération depuis un instant T === |
- | <code xml> | + | <code javascript> |
- | <?xml version="1.0" encoding="UTF-8"?><ONIXMessage release="3.0" xmlns="http://www.editeur.org/onix/3.0/reference"> | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/getNotices?glnGroup=0000000000000&glnContractor=30269000010012&sinceDate=2010-08-20T00:00:00 |
- | <Header> | + | |
- | <Sender> | + | |
- | <SenderIdentifier><SenderIDType>06</SenderIDType><IDValue>3025599000108</IDValue></SenderIdentifier> | + | |
- | <SenderName>SERVEUR DILICOM - HUB NUMERIQUE</SenderName></Sender> | + | |
- | <Addressee><AddresseeIdentifier><AddresseeIDType>06</AddresseeIDType><IDValue>3012410001000</IDValue></AddresseeIdentifier></Addressee> | + | |
- | <SentDateTime>20101103T0529Z</SentDateTime> | + | |
- | </Header> | + | |
- | <Product><RecordReference>immateriel.fr-RP944</RecordReference><NotificationType>03</NotificationType><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>RP944</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>3600120309440</IDValue></ProductIdentifier><DescriptiveDetail><ProductComposition>00</ProductComposition><ProductForm>ED</ProductForm><ProductFormDetail>E107</ProductFormDetail><ProductFormDescription>PDF</ProductFormDescription><EpubTechnicalProtection>02</EpubTechnicalProtection><EpubUsageConstraint><EpubUsageType>02</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>03</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>04</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><TitleDetail><TitleType>01</TitleType><TitleElement><TitleElementLevel>01</TitleElementLevel><TitleText>Mieux programmer en C++</TitleText></TitleElement></TitleDetail></DescriptiveDetail><RelatedMaterial><RelatedProduct><ProductRelationCode>02</ProductRelationCode><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>O18600</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier></RelatedProduct></RelatedMaterial><ProductSupply><SupplyDetail><Supplier><SupplierRole>03</SupplierRole><SupplierIdentifier><SupplierIDType>02</SupplierIDType><IDValue>D1</IDValue></SupplierIdentifier><SupplierIdentifier><SupplierIDType>06</SupplierIDType><IDValue>3012410001000</IDValue></SupplierIdentifier><SupplierName>immatériel.fr</SupplierName></Supplier><ProductAvailability>45</ProductAvailability><UnpricedItemType>03</UnpricedItemType></SupplyDetail></ProductSupply></Product> | + | |
- | + | ||
- | </ONIXMessage> | + | |
</code> | </code> | ||
- | ===== Chargement des notices onix par lien direct : getNotices() ===== | ||
- | <note important>Attention ce service ne retourne pas du JSON mais directement un message ONIX, donc au format XML.</note> | ||
- | ==== Interrogation du web service ==== | + | === Cas 3 - Récupération depuis la dernière connexion === |
+ | <code javascript> | ||
+ | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/getNotices?glnGroup=0000000000000&glnContractor=30269000010012&lastConnection | ||
+ | </code> | ||
- | === Cas 1=> Initialisation du catalogue === | + | ==== Réponse du Web Service ==== |
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/onix/getNotices?initialization | + | { |
+ | onixFileUrls:[{ | ||
+ | httpLink:"https://hub-dilicom.centprod.com/notices_onix/diffusion_3025594195700_201008272128_1110247456419854240546744705832927698715.xml" | ||
+ | },{ | ||
+ | httpLink:"https://hub-dilicom.centprod.com/notices_onix/diffusion_3025594164342_201008272330_1256851354542405467447058329276987145685.xml" | ||
+ | }], | ||
+ | returnStatus:"OK" | ||
+ | } | ||
</code> | </code> | ||
- | === Cas 2 => Récupération depuis un instant T === | + | <note important>L'exemple présente le cas où plusieurs fichiers sont renvoyés. Actuellement le web service renvoie toujours un seul lien, cependant il est possible qu'à terme il soit nécessaire de renvoyer plusieurs liens.</note> |
+ | |||
+ | Ou bien lorsque aucune notice ne correspond à la demande : | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/onix/getNotices?sinceDate=2010-08-20T00:00:00 | + | { |
+ | noNotice: "", | ||
+ | returnStatus:"OK" | ||
+ | } | ||
</code> | </code> | ||
+ | ===== Récupération des notices pour un seul distributeur : getNoticesForDistributor() ===== | ||
+ | <note important> Service non implémenté en REST. </note> | ||
- | === Cas 3 => Récupération depuis la dernière connexion === | + | ===== Obtention de notices onix d'une liste d'ean/distributeur : getDetailNotices() ===== |
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/json/getDetailNotices?** | ||
+ | |||
+ | ==== Interrogation du web service ==== | ||
<code javascript> | <code javascript> | ||
- | https://hub-dilicom.centprod.com/v1/hub-numerique-api/onix/getNotices?lastConnection | + | https://hub-dilicom.centprod.com/v3/hub-numerique-api/json/getDetailNotices? |
+ | glnContractor=0000000000000 | ||
+ | ¬ices[0].ean13=9782092528068 | ||
+ | ¬ices[0].glnDistributor=3012410003004 | ||
+ | ¬ices[1].ean13=9782092628068 | ||
+ | ¬ices[1].glnDistributor=3012410003004 | ||
</code> | </code> | ||
- | |||
==== Réponse du web service ==== | ==== Réponse du web service ==== | ||
+ | <code javascript> | ||
+ | { | ||
+ | "detailNotices" : [ { | ||
+ | "ean13" : "9782092528068", | ||
+ | "onixProduct" :"<ONIXMessage>.....</ONIXMessage>" , | ||
+ | "glnDistributor" : "3012410003004" | ||
+ | }, { | ||
+ | "ean13" : "9782092628068", | ||
+ | "glnDistributor" : "3012410003004", | ||
+ | "noNotice" : "" | ||
+ | } ], | ||
+ | "returnStatus" : "OK" | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | ===== Chargement de la notices d'un produit directement au format ONIX : getNotice() ===== | ||
+ | <note important>Attention ce service ne retourne pas du JSON mais directement un message ONIX, donc au format XML.</note> | ||
+ | |||
+ | |||
+ | |||
+ | ==== URL ==== | ||
+ | **[ [[:start#les_differentes_plateformes_gerees_par_le_hub|Nom de la plateforme]]]/v[ [[[hub_principal:start#versions_de_l_api_hub|numéro de version]] ]/hub-numerique-api/onix/getNotice?** | ||
+ | |||
- | Le service répond un code HTTP ''204 No content'' lorsqu'aucune notice ne correspond à la demande. | ||
- | Si la mise à jour contient des fiches le service redirige vers un fichier onix contenant les notices demandées. | ||
+ | ==== Interrogation du web service ==== | ||
+ | <code javascript> | ||
+ | https://hub-dilicom.centprod.com/v3/hub-numerique-api/onix/getNotice? | ||
+ | glnContractor=0000000000000 | ||
+ | &ean13=3600120309440 | ||
+ | &glnDistributor=3012410001000 | ||
+ | </code> | ||
+ | |||
+ | ==== Réponse du web service ==== | ||
<code xml> | <code xml> | ||
<?xml version="1.0" encoding="UTF-8"?><ONIXMessage release="3.0" xmlns="http://www.editeur.org/onix/3.0/reference"> | <?xml version="1.0" encoding="UTF-8"?><ONIXMessage release="3.0" xmlns="http://www.editeur.org/onix/3.0/reference"> | ||
Ligne 365: | Ligne 378: | ||
</Header> | </Header> | ||
<Product><RecordReference>immateriel.fr-RP944</RecordReference><NotificationType>03</NotificationType><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>RP944</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>3600120309440</IDValue></ProductIdentifier><DescriptiveDetail><ProductComposition>00</ProductComposition><ProductForm>ED</ProductForm><ProductFormDetail>E107</ProductFormDetail><ProductFormDescription>PDF</ProductFormDescription><EpubTechnicalProtection>02</EpubTechnicalProtection><EpubUsageConstraint><EpubUsageType>02</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>03</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>04</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><TitleDetail><TitleType>01</TitleType><TitleElement><TitleElementLevel>01</TitleElementLevel><TitleText>Mieux programmer en C++</TitleText></TitleElement></TitleDetail></DescriptiveDetail><RelatedMaterial><RelatedProduct><ProductRelationCode>02</ProductRelationCode><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>O18600</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier></RelatedProduct></RelatedMaterial><ProductSupply><SupplyDetail><Supplier><SupplierRole>03</SupplierRole><SupplierIdentifier><SupplierIDType>02</SupplierIDType><IDValue>D1</IDValue></SupplierIdentifier><SupplierIdentifier><SupplierIDType>06</SupplierIDType><IDValue>3012410001000</IDValue></SupplierIdentifier><SupplierName>immatériel.fr</SupplierName></Supplier><ProductAvailability>45</ProductAvailability><UnpricedItemType>03</UnpricedItemType></SupplyDetail></ProductSupply></Product> | <Product><RecordReference>immateriel.fr-RP944</RecordReference><NotificationType>03</NotificationType><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>RP944</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>3600120309440</IDValue></ProductIdentifier><DescriptiveDetail><ProductComposition>00</ProductComposition><ProductForm>ED</ProductForm><ProductFormDetail>E107</ProductFormDetail><ProductFormDescription>PDF</ProductFormDescription><EpubTechnicalProtection>02</EpubTechnicalProtection><EpubUsageConstraint><EpubUsageType>02</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>03</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><EpubUsageConstraint><EpubUsageType>04</EpubUsageType><EpubUsageStatus>01</EpubUsageStatus></EpubUsageConstraint><TitleDetail><TitleType>01</TitleType><TitleElement><TitleElementLevel>01</TitleElementLevel><TitleText>Mieux programmer en C++</TitleText></TitleElement></TitleDetail></DescriptiveDetail><RelatedMaterial><RelatedProduct><ProductRelationCode>02</ProductRelationCode><ProductIdentifier><ProductIDType>01</ProductIDType><IDValue>O18600</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9782212850185</IDValue></ProductIdentifier></RelatedProduct></RelatedMaterial><ProductSupply><SupplyDetail><Supplier><SupplierRole>03</SupplierRole><SupplierIdentifier><SupplierIDType>02</SupplierIDType><IDValue>D1</IDValue></SupplierIdentifier><SupplierIdentifier><SupplierIDType>06</SupplierIDType><IDValue>3012410001000</IDValue></SupplierIdentifier><SupplierName>immatériel.fr</SupplierName></Supplier><ProductAvailability>45</ProductAvailability><UnpricedItemType>03</UnpricedItemType></SupplyDetail></ProductSupply></Product> | ||
- | <Product> | ||
- | .... | ||
- | |||
- | </Product> | ||
</ONIXMessage> | </ONIXMessage> | ||
</code> | </code> | ||
+ | |||
+ |