Forum - Book a room via API

  • This topic has 5 replies, 2 voices, and was last updated 4 weeks, 1 day ago by Sebastien Leyreloup.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #65165
    Sebastien Leyreloup

    I want to book a room via API in alma. My test works but I don’t see in the request xml the item_id and barcode attributes of the room.
    If i do the same operation directly in alma, i see theses 2 attributes…

    I use the API POST /almaws/v1/users/{user_id}/requests

    I provide the good user_id, mms_id and pid_item parameters…

    My body request paramater is like this :

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <pickup_location>BU Richter</pickup_location>
    <comment>Test from API</comment>

    I don’t understand whats’s wrong ? Thanks.

    Sebastien Leyreloup

    I also used the API POST /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items/{item_pid}/requests
    and i have the same result : no item_id and barcode attributes in my xml request.

    Tami Fuches

    Are you sending the mms_id and item_pid as parameters?
    They should be sent as parameters, not as part of the body.
    See documentation of the API:

    Alma API team

    Sebastien Leyreloup

    Yes of course, i send the mms_id and item_pid as parameter, not as part of the body.

    When i use the API Console from Ex Libris Developer Network with my token, i have the same problem.

    My test code in PHP is like that :




    $start = gmdate(‘Y-m-d\TH:i:s\Z’, strtotime(“2020-02-17 08:30:00”));
    $stop = gmdate(‘Y-m-d\TH:i:s\Z’, strtotime(“2020-02-17 10:30:00″));

    $request_date = gmdate(‘Y-m-d\TH:i:s\Z’);

    // Store XML Request object in Variable for passing to curl
    $request_xml = ‘<?xml version=”1.0″ encoding=”UTF-8”?>
    <pickup_location>BU Sciences</pickup_location>

    $ch = curl_init();
    $url = ‘;.$user_id.’/requests’;
    $queryParams = ‘?’ . urlencode(‘user_id_type’) . ‘=’ . urlencode(‘all_unique’) . ‘&’ . urlencode(‘mmsid’) . ‘=’ . $selected_mms_id . ‘&’ . urlencode(‘item_pid’) . ‘=’ . $selected_item_id . ‘&’ . urlencode(‘lang’). ‘=’. urlencode(‘fr’). ‘&’ . urlencode(‘apikey’) . ‘=’ . urlencode($token);
    curl_setopt($ch, CURLOPT_URL, $url . $queryParams);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request_xml);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/xml’));
    $response = curl_exec($ch);



    I test to add <item_id></item_id> and <barcode></barcode> in the xml user_request body parameter but that do nothing else…
    Thanks for your help.

    • This reply was modified 1 month, 2 weeks ago by Sebastien Leyreloup.
    Sebastien Leyreloup

    I have do more tests today and now, even if i make a booking via Alma, i do not retrieve the bar-code in the xml request nor in alma.
    I have now the same result when i do a booking from alma and from API.

    So i think there are modification about this in the March release update of alma…

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.