Каким должен быть URL-адрес для webServiceURL для Apple Passkit

#ios #node.js #ruby #passkit

Вопрос:

Я создаю учетные данные для Apple Passkit.

Пример, предоставленный Apple, написан на Ruby (с которым я не знаком) и использует конечную точку /v1/устройства/идентификатор устройства/регистрации/тип / серийный

Я написал конечную точку в express по адресу «/v1/устройства/:идентификатор устройства/регистрации/:идентификатор типа пароля/:серийный номер».

Какой URL-адрес я должен использовать для webServiceURL в наборе паролей Apple, чтобы он подключался к конечной точке узла.

Я использовал «webServiceURL» : «https://myapp.com/v1/devices»,

Функция NodeJS является

 app.post('/v1/devices/:device_id/registrations/:pass_type_id/:serial_number', async (req, res, next)=>{
 

Это код Apple, предоставленный

   post '/v1/devices/:device_id/registrations/:pass_type_id/:serial_number' do
    puts "Handling registration request..."
    # validate that the request is authorized to deal with the pass referenced
    puts "#<RegistrationRequest device_id: #{params[:device_id]}, pass_type_id: #{params[:pass_type_id]}, serial_number: #{params[:serial_number]}, authentication_token: #{authentication_token}, push_token: #{push_token}>"
    if @passes.where(:serial_number => params[:serial_number]).where(:authentication_token => authentication_token).first
      
      puts 'Pass and authentication token match.'
      
      # Validate that the device has not previously registered
      # Note: this is done with a composite key that is combination of the device_id and the pass serial_number
      uuid = params[:device_id]   "-"   params[:serial_number]
      if @registrations.where(:uuid => uuid).count < 1
        
        # No registration found, lets add the device
        @registrations.insert(:uuid => uuid, :device_id => params[:device_id], :pass_type_id => params[:pass_type_id], :push_token => push_token, :serial_number => params[:serial_number])
        
        # Return a 201 CREATED status
        status 201
      else
        # The device has already registered for updates on this pass
        # Acknowledge the request with a 200 OK response
        status 200
      end
      
    else
      # The device did not statisfy the authentication requirements
      # Return a 401 NOT AUTHORIZED response
      status 401
    end

  end